feat: hecha la parte de gestion de propiedades en venta
This commit is contained in:
@@ -58,6 +58,36 @@ public class PropiedadesController: ControllerBase {
|
||||
return Ok(l);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedades/Venta/Propietario")]
|
||||
public IActionResult ObtenerPropiedadesVentaDePropietario( [FromHeader(Name = "Auth")] string Auth){
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) {
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return Unauthorized();
|
||||
|
||||
var props = RepositorioPropiedades.Singleton.ObtenerPropiedadesAVentaPorDni(cli.Dni);
|
||||
List<PropiedadesDto> ll = new();
|
||||
|
||||
foreach (var i in props) {
|
||||
var a = new PropiedadesDto {
|
||||
id = i.Id,
|
||||
Ubicacion = i.Ubicacion,
|
||||
canthabitaciones = i.Canthabitaciones,
|
||||
Iddivisa = i.Iddivisa,
|
||||
letra = i.Letra??"",
|
||||
Monto = (int)i.Monto, //mmmm
|
||||
piso = i.Piso??0,
|
||||
Servicios = string.Join(", ", i.IdServicios.Select(x => x.Descripcion)),
|
||||
Tipo = i.IdtipropiedadNavigation.Descripcion,
|
||||
};
|
||||
ll.Add(a);
|
||||
}
|
||||
return Ok(ll);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedad")]
|
||||
public IActionResult ObtenerPropiedadPorId(int Id, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
|
||||
Reference in New Issue
Block a user