feat: hecha la parte de gestion de propiedades en venta

This commit is contained in:
2025-02-01 18:10:24 -03:00
parent af231344b6
commit 2a8ba5a9f4
9 changed files with 257 additions and 10 deletions

View File

@@ -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();