public void Update(DalUser entity) { User user = context.Set <User>().FirstOrDefault(u => u.Id == entity.Id); if (user != null) { user.PasswordHash = entity.PasswordHash; user.Roles = GetRoles(entity.Roles.Select(r => r.Name)).ToList(); } }
public void Create(DalUser entity) { User user = new User() { Email = entity.Email, PasswordHash = entity.PasswordHash, CreationDate = entity.CreationDate, Roles = GetRoles(entity.Roles.Select(r => r.Name)).ToList() }; context.Set <User>().Add(user); }