public void Delete(int id) { using (var db = new paginaEntities()) { var venta = db?.Ventas?.Where(x => x.id == id)?.First(); if (venta != null) { db.Ventas.Remove(venta); db.SaveChanges(); } } }
public VentaModel Register(VentaModel src) { using (var db = new paginaEntities()) { if (src != null) { var ventaM = db?.Ventas?.Add(_ventMap.MapNew(src)); db?.SaveChanges(); return(_ventMMap.MapNew(ventaM)); } return(null); } }
public SesionModel GetByKeyPair(Tuple <string, string> keyValue) { using (var db = new paginaEntities()) { var sesion = db.Sesiones?. Where(x => x.key.Equals(keyValue.Item1) && x.value.Equals(keyValue.Item2))?.FirstOrDefault(); if (sesion != null) { return(_sesMMap.MapNew(sesion)); } return(null); } }
public IEnumerable <InventarioModel> GetAll() { using (var db = new paginaEntities()) { if (db?.Inventarios != null) { foreach (var inventario in db.Inventarios) { yield return(_invMMap.MapNew(inventario)); } } } }
public IEnumerable <PerfilModel> GetAll() { using (var db = new paginaEntities()) { if (db?.Perfiles != null) { foreach (var perfil in db.Perfiles) { yield return(_perfilMMap.MapNew(perfil)); } } } }
public InventarioModel Register(InventarioModel src) { using (var db = new paginaEntities()) { if (src != null) { var inventarioM = db?.Inventarios?.Add(_invMap.MapNew(src)); db?.SaveChanges(); return(_invMMap.MapNew(inventarioM)); } return(null); } }
public UsuarioModel Register(UsuarioModel src) { using (var db = new paginaEntities()) { if (src != null) { var usuarioM = db?.Usuarios?.Add(_usrMap.MapNew(src)); db?.SaveChanges(); return(_usrMMap.MapNew(usuarioM)); } return(null); } }
public IEnumerable <VentaModel> GetAll() { using (var db = new paginaEntities()) { if (db?.Ventas != null) { foreach (var venta in db.Ventas) { yield return(_ventMMap.MapNew(venta)); } } } }
public IEnumerable <ArticuloModel> GetAll() { using (var db = new paginaEntities()) { if (db?.Articulos != null) { foreach (var articulo in db.Articulos) { yield return(_artMMap.MapNew(articulo)); } } } }
public SesionModel Register(SesionModel src) { using (var db = new paginaEntities()) { if (src != null) { var sesionM = db?.Sesiones?.Add(_sesMap.MapNew(src)); db?.SaveChanges(); return(_sesMMap.MapNew(sesionM)); } return(null); } }
public IEnumerable <SesionModel> GetAll() { using (var db = new paginaEntities()) { if (db?.Sesiones != null) { foreach (var sesion in db.Sesiones) { yield return(_sesMMap.MapNew(sesion)); } } } }
public ArticuloModel Register(ArticuloModel src) { using (var db = new paginaEntities()) { if (src != null) { var articuloM = db?.Articulos?.Add(_artMap.MapNew(src)); db?.SaveChanges(); return(_artMMap.MapNew(articuloM)); } return(null); } }
public PerfilModel Register(PerfilModel src) { using (var db = new paginaEntities()) { if (src != null) { var perfilM = db?.Perfiles?.Add(_perfilMap.MapNew(src)); db?.SaveChanges(); return(_perfilMMap.MapNew(perfilM)); } return(null); } }
public IEnumerable <UsuarioModel> GetAll() { using (var db = new paginaEntities()) { if (db?.Usuarios != null) { foreach (var usuario in db?.Usuarios) { yield return(_usrMMap.MapNew(usuario)); } } } }
public void Update(InventarioModel src) { using (var db = new paginaEntities()) { if (src != null) { var inventario = db?.Inventarios?.Where(x => x.id == src.Id)?.First(); if (inventario != null) { _invMap.Map(src, inventario); db.SaveChanges(); } } } }
public void Update(UsuarioModel src) { using (var db = new paginaEntities()) { if (src != null) { var usuario = db?.Usuarios?.Where(x => x.id == src.Id)?.First(); if (usuario != null) { _usrMap.Map(src, usuario); db.SaveChanges(); } } } }
public void Update(SesionModel src) { using (var db = new paginaEntities()) { if (src != null) { var sesion = db?.Sesiones?.Where(x => x.id == src.Id)?.First(); if (sesion != null) { _sesMap.Map(src, sesion); db.SaveChanges(); } } } }
public void Update(ArticuloModel src) { using (var db = new paginaEntities()) { if (src != null) { var articulo = db?.Articulos?.Where(x => x.id == src.Id)?.First(); if (articulo != null) { _artMap.Map(src, articulo); db.SaveChanges(); } } } }
public void Update(PerfilModel src) { using (var db = new paginaEntities()) { if (src != null) { var perfil = db?.Perfiles?.Where(x => x.id == src.Id)?.First(); if (perfil != null) { _perfilMap.Map(src, perfil); db.SaveChanges(); } } } }
public void Update(VentaModel src) { using (var db = new paginaEntities()) { if (src != null) { var venta = db?.Ventas?.Where(x => x.id == src.Id)?.First(); if (venta != null) { _ventMap.Map(src, venta); db.SaveChanges(); } } } }