feat: ahora se pueden ver las propiedades dadas de baja y añadido el tema de los servicios
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
@@ -46,6 +46,22 @@ public class PropiedadesController: ControllerBase {
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedades/Propietario/Bajas")]
|
||||
public IActionResult ObtenerPropiedadesPorPropietarioBajas (
|
||||
[FromHeader(Name = "Email")] string email,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 8);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
email = email.Trim();
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new {message ="falta campo email"});
|
||||
|
||||
IQueryable<PropiedadesDto> ret = RepositorioPropiedades.Singleton.ObtenerPropiedadesDeBajaPorEmail(email);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpPost("api/propiedad")]
|
||||
public IActionResult AltaPropiedad([FromBody] AltaPropiedadDto propiedad, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
@@ -86,6 +102,8 @@ public class PropiedadesController: ControllerBase {
|
||||
Cliente? cli = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(propiedad.Email);
|
||||
if (cli == null) return BadRequest(new { message = "El email no corresponde a un propietario"});
|
||||
|
||||
List<Servicio> servs = RepositorioServicios.Singleton.ObtenerServiciosPorDescripcion(propiedad.Servicios);
|
||||
|
||||
Propiedade Prop = new Propiedade{
|
||||
Id = propiedad.id,
|
||||
Canthabitaciones = propiedad.Canthabitaciones,
|
||||
@@ -94,6 +112,7 @@ public class PropiedadesController: ControllerBase {
|
||||
Ubicacion = propiedad.Ubicacion,
|
||||
Letra = propiedad.Letra ?? null,
|
||||
Piso = propiedad.Piso ?? null,
|
||||
IdServicios = servs,
|
||||
};
|
||||
|
||||
bool ret = RepositorioPropiedades.Singleton.PatchPropiedad(Prop);
|
||||
@@ -115,8 +134,8 @@ public class PropiedadesController: ControllerBase {
|
||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id, propie);
|
||||
|
||||
return ret ?
|
||||
Ok(new {message = $"la propiedad con id {id} fue dada de baja"}):
|
||||
BadRequest(new {message="Fallo al dar de baja la propiedad"});
|
||||
Ok(new { message = $"Se Cambio el estado de la propiedad con id {id}"}):
|
||||
BadRequest(new {message="Fallo al cambiar el estado de la propiedad"});
|
||||
}
|
||||
|
||||
[HttpPut("api/propiedades/addServicio")]
|
||||
|
||||
Reference in New Issue
Block a user