public async Task <IActionResult> Create(User u) { var grade = _context.Grade.First(n => n.Id == u.GradeId); u.GradeName = grade.GradeName; u.GradeLevel = grade.GradeLevel; u.GradeStep = grade.GradeStep; u.Housing = grade.Housing; u.HousingItemType = grade.HousingItemType; u.Lunch = grade.Lunch; u.LunchItemType = grade.LunchItemType; u.Medical = grade.Medical; u.MedicalItemType = grade.MedicalItemType; u.Transport = grade.Transport; u.TransportItemType = grade.TransportItemType; u.Tax = grade.Tax; u.BasicSalary = grade.BasicSalary; u.GrossSalary = grade.GrossSalary; u.NetSalary = grade.NetSalary; var createUser = await _user.AddAsync(u); if (createUser) { Alert("User created successfully.", NotificationType.success); return(RedirectToAction("Index", "User")); } else { Alert("User not created!", NotificationType.error); } return(View()); }
public async Task <User> Register(User user, string password) { try { byte[] passwordHash, passwordSalt; CreatePasswordHash(password, out passwordHash, out passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; // await _dbContext.Users.AddAsync(user); // await _dbContext.SaveChangesAsync(); await _userService.AddAsync(user); await _userService.SaveAsync(); } catch (Exception ex) { throw ex; } return(user); }
public virtual void AddAsync(bool addAll = false, Infastructure.ProgressReporter pg = null) { _user.AddAsync(addAll, pg); }