public User GetUserModel(RegisterUserViewModel model) { var item = new User(); item.Id = model.ID; item.Username = model.Username; item.Password = model.Password; item.IdRole = model.IdRole; item.Email = model.Email; item.Name = model.FullName; return item; }
public ActionResult Create(RegisterUserViewModel model) { if (ModelState.IsValid) { var user = new User(); user.Username = model.Username; user.Password = MD5Helper.Encrypt(model.ConfirmPassword, true); user.Name = model.FullName; user.Email = model.Email; //user.Password = MD5Helper.Encrypt(model.ConfirmPassword); user.IdRole = model.IdRole; if (_iServiceUser.SaveAdd(user)) { SessionUserHelper.CreateSessionSuccess(ConstantStrings.AddSuccess); } else { SessionUserHelper.CreateSessionError(ConstantStrings.AddNonSuccess); } return RedirectToAction("Index"); } return View(model); }