private static Tipohardware SetEntity(TipoHardwareModel model, Tipohardware entity) { entity.Id = model.Id; entity.Descricao = model.Descricao; return(entity); }
public bool Update(TipoHardwareModel entity) { var x = _context.Tipohardware.Where(th => th.Id == entity.Id).FirstOrDefault(); if (x != null) { _context.Update(SetEntity(entity, x)); return(_context.SaveChanges() == 1 ? true : false); } return(false); }
public bool Insert(TipoHardwareModel entity) { _context.Add(SetEntity(entity, new Tipohardware())); return(_context.SaveChanges() == 1); }