public long Add(UserDto dto) { dto.Id = 0; var user = Mapper.Map <User>(dto); user = _context.Users.Add(user); _context.SaveChanges(); return(user.Id); }
public void AddUserPermissions(long userId, UserType userType) { var theUser = Context.Users.Include("Permissions").SingleOrDefault(u => u.Id == userId); if (theUser.Permissions == null) { theUser.Permissions = new List <Permission>(); } var newPermissions = Context.Permissions.Where(p => p.UserType.Id == userType.Id).ToList(); theUser.Permissions.AddRange(newPermissions); Context.SaveChanges(); }
public void Insert(PasswordReset pwdReset) { _context.PasswordLinks.Add(pwdReset); _context.SaveChanges(); }