solo añadi una parte
This commit is contained in:
@@ -470,6 +470,34 @@ public class ContratoController: ControllerBase {
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("api/contratos/garantes")]
|
||||
public IActionResult ObtenerGarantes([FromHeader(Name ="Auth")] string Auth, int idcontrato) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest();
|
||||
if(idcontrato <= 0) return BadRequest();
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest();
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(idcontrato);
|
||||
if (cont == null) return BadRequest();
|
||||
|
||||
if (cont.Dniinquilino != cli.Dni && cont.Dnipropietario != cli.Dni) return BadRequest();
|
||||
|
||||
var list = cont.Idgarantes;
|
||||
List<GaranteDto> l = new();
|
||||
foreach (var i in list) {
|
||||
l.Add(new GaranteDtoBuilder()
|
||||
.SetCelular(i.Celular)
|
||||
.SetDni(i.Dni)
|
||||
.SetDomicilio(i.Domicilio)
|
||||
.SetDomicilioLaboral(i.Domiciliolaboral)
|
||||
.SetNombre(i.Nombre)
|
||||
.SetApellido(i.Apellido)
|
||||
.Build());
|
||||
}
|
||||
return Ok(l);
|
||||
}
|
||||
|
||||
private string ValidarCancelarDto(CancelarPrecontratoDto dto) {
|
||||
if (dto == null) return "dto nulo";
|
||||
string ret = "";
|
||||
@@ -513,7 +541,7 @@ public class ContratoController: ControllerBase {
|
||||
if (dto.EmailInquilino == "") ret += "el email del inquilino no puede ser nulo\n";
|
||||
if (dto.EmailPropietario == "") ret += "el email del propietario no puede estar vacio\n";
|
||||
if (dto.IdPropiedad <= 0) ret += "la id de propiedad no puede ser igual o menor a 0\n";
|
||||
if (dto.MesesHastaAumento <= 0) ret += "No puede tener 0 o menos meses hasta el aumento\n"
|
||||
if (dto.MesesHastaAumento <= 0) ret += "No puede tener 0 o menos meses hasta el aumento\n";
|
||||
if (dto.MesesDuracionContrato <= 0) ret += "No puede tener 0 o menos meses de duracion\n";
|
||||
if (dto.MesesDuracionContrato < dto.MesesHastaAumento) ret += "el tiempo hasta aumento no puede ser mayor de \n";
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user