Exemplo n.º 1
0
        private static Tipohardware SetEntity(TipoHardwareModel model, Tipohardware entity)
        {
            entity.Id        = model.Id;
            entity.Descricao = model.Descricao;

            return(entity);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public bool Insert(TipoHardwareModel entity)
 {
     _context.Add(SetEntity(entity, new Tipohardware()));
     return(_context.SaveChanges() == 1);
 }