Exemplo n.º 1
0
 public bool UpdateEmployee(Employee item)
 {
     var employeeToUpdate = _context.Employees.SingleOrDefault(e => e.Id == item.Id);
     if (employeeToUpdate == null)
     {
         return false;
     }
     else
     {
         employeeToUpdate.FirstName = item.FirstName;
         employeeToUpdate.LastName = item.LastName;
         employeeToUpdate.BirthDay = item.BirthDay;
         employeeToUpdate.DepId = item.DepId;
         _context.SaveChanges();
         return true;
     }
 }
Exemplo n.º 2
0
 public Employee InsertEmployee(Employee item)
 {
     var added_item = _context.Employees.Add(item);
     _context.SaveChanges();
     return added_item;
 }