primera parte de añadir lo de contratos
This commit is contained in:
@@ -4,6 +4,29 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Modelo;
|
||||
public class RepositorioContratos: RepositorioBase<RepositorioContratos> {
|
||||
|
||||
|
||||
public bool AdminCargaContrato(Contrato? cont, long dni){
|
||||
if (cont == null) return false;
|
||||
|
||||
var con = Context;
|
||||
|
||||
cont.Id = (con.Contratos.Any() ? con.Contratos.Max(x => x.Id) : 0) + 1;
|
||||
|
||||
if (cont.IdventaNavigation != null){
|
||||
cont.IdventaNavigation.Id = (con.Ventas.Any()?con.Ventas.Count():0)+1;
|
||||
con.Ventas.Add(cont.IdventaNavigation);
|
||||
}
|
||||
|
||||
var prop = con.Propiedades.FirstOrDefault(x=>x.Id == cont.Idpropiedad);
|
||||
if (prop == null)return false;
|
||||
|
||||
prop.Idestado = 2;
|
||||
con.Contratos.Add(cont);
|
||||
GenerarLog(con, dni, "Carga del contrato por parte de admin");
|
||||
return Guardar(con);
|
||||
}
|
||||
|
||||
public IQueryable<Contrato>? ObtenerContratosPorEmailInquilino(string email) {
|
||||
var con = Context;
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user