falta interfaz venta
This commit is contained in:
26
Modelo/RepositorioVentas.cs
Normal file
26
Modelo/RepositorioVentas.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Entidades;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Modelo;
|
||||
public class RepositorioVentas: RepositorioBase<RepositorioVentas> {
|
||||
public Contrato? ObtenerVentaPorContrato(long idcontrato) {
|
||||
var con = Context;
|
||||
var c = con.Contratos.Include(x=>x.Idcanons).Include(x=>x.IdventaNavigation).ThenInclude(x=>x.IddivisaNavigation)
|
||||
.FirstOrDefault(x=>x.Id == idcontrato);
|
||||
if (c == null || c.IdventaNavigation == null) return null;
|
||||
return c;
|
||||
}
|
||||
|
||||
public bool PatchVenta(Venta venta) {
|
||||
var con = Context;
|
||||
var a = con.Ventas.FirstOrDefault(x=>x.Id == venta.Id);
|
||||
|
||||
a.IdVendedor = venta.IdVendedor;
|
||||
a.IdComprador = venta.IdComprador;
|
||||
a.Idpropiedad = venta.Idpropiedad;
|
||||
a.Fechainicio = venta.Fechainicio;
|
||||
a.Idestado=2;
|
||||
|
||||
return Guardar(con);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user