public ActionResult AddRegistration(UserAccount userAccount) { if (ModelState.IsValid) { if (_userAccountManager.Add(userAccount)) { ViewBag.successMsg = userAccount.UserName + " added"; ModelState.Clear(); } } return(View()); }
public IActionResult Post([FromBody] UserPost user) { if (!ModelState.IsValid) { BadRequest(ModelState); } var userAccount = UserAccount.FromUserNameAndPassword(user.UserName, user.Password, user.EmailAddress); var userAccountManager = new UserAccountManager(); userAccountManager.Add(userAccount); return(CreatedAtAction(nameof(Get), userAccount)); }
public ActionResult Register(UserAccountEntryVm model) { if (ModelState.IsValid) { var userAccount = Mapper.Map <UserAcount>(model); bool usr = _userAccountManager.Add(userAccount); if (usr) { ModelState.Clear(); ViewBag.msc = model.FirstName + " " + model.LastName + " " + "Successfully Registered"; //return RedirectToAction("Login"); } } return(View()); }