Ejemplo n.º 1
0
 public ActionResult Register(RegisterModel model)
 {
     if(ModelState.IsValid)
     {
         var user = new ApplicationUser { UserName = model.UserName, Email = model.Email, PhoneNumber = model.PhoneNumber };
         var result = UserManager.Create(user, model.Password);
         if(result.Succeeded)
         {
             SignInManager.SignIn(user, isPersistent: false, rememberBrowser: false);
             return RedirectToAction(WebConstants.HomeController.Index, WebConstants.HomeController.Controller);
         }
         AddErrors(result);
     }
     return View(model);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// This method sets the non editable fields on the Manage user screen. We need to set these fields when 
 /// initially render the page as well as after a postback on the Manage screen. These are non editable fields and
 /// if not set after postback they will be null.
 /// </summary>
 /// <param name="user"></param>
 /// <param name="model"></param>
 private void SetAuditAndTaskInformation(ApplicationUser user, ManageModel model)
 {
     var earliestTodo = user.Todos.OrderBy(x => x.DueOn).First(x => !x.IsComplete);
     model.TaskCount = user.Todos.Count();
     model.EarliestTask = earliestTodo.Description;
     model.DueOn = earliestTodo.DueOn.ToShortDateString();
     model.AuditLogs = _userService.GetAuditForUser(user.Id);
 }