public Employee RefreshEmployeeInfo(Employee employee) { if (!_context.Employees.Any(e => e.Id.Equals(employee.Id))) { return(null); } var result = _context.Employees.SingleOrDefault(e => e.Id.Equals(employee.Id)); if (result != null) { try { _context.Entry(result).CurrentValues.SetValues(employee); _context.SaveChanges(); return(result); } catch (Exception) { throw; } } return(result); }
public User RefreshUserInfo(User user) { if (!_context.Users.Any(u => u.Id.Equals(user.Id))) { return(null); } var result = _context.Users.SingleOrDefault(p => p.Id.Equals(user.Id)); if (result != null) { try { _context.Entry(result).CurrentValues.SetValues(user); _context.SaveChanges(); return(result); } catch (Exception) { throw; } } return(result); }
public Person Update(Person person) { if (!Exists(person.Id)) { return(new Person()); } var result = _context.People.SingleOrDefault(p => p.Id.Equals(person.Id)); if (result != null) { try { _context.Entry(result).CurrentValues.SetValues(person); _context.SaveChanges(); } catch (Exception) { throw; } } return(person); }
public void Update(UserAccount user) { db.Entry(user).State = EntityState.Modified; }
public void Update(School school) { db.Entry(school).State = EntityState.Modified; }