public GetUserDto GetById(int id) { User user = context.Users .FirstOrDefault(u => u.Id == id); if (user == null) { return(null); } return(GetUserDto.FromUser(user)); }
public GetUserDto Delete(int id) { var existing = context.Users.FirstOrDefault(u => u.Id == id); if (existing == null) { return(null); } context.Users.Remove(existing); context.SaveChanges(); return(GetUserDto.FromUser(existing)); }