public PartialViewResult ChildReport(string Id) { Parent parent = context.Parents.FirstOrDefault(p => p.ChildId == Id); Child child = context.Children.FirstOrDefault(c => c.Id == Id); NurseryUser user = context.Users.FirstOrDefault(u => u.Id == parent.UserId); ParentUserChildViewModel model = new ParentUserChildViewModel(); model.user = user; model.child = child; model.parent = parent; return(PartialView("_ChildReport", model)); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (User.Identity.IsAuthenticated) { return(RedirectToAction("index", "home")); } if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { NurseryUser nurseryUser = new NurseryUser() { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, Street = model.Street, City = model.City, asp_User_ID = user.Id }; context.Users.Add(nurseryUser); context.SaveChanges(); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public PartialViewResult getUser() { NurseryUser user = context.Users.FirstOrDefault(u => u.Email == User.Identity.Name); return(PartialView("_getUser", user)); }
// GET: User public ActionResult Index() { NurseryUser user = context.Users.FirstOrDefault(u => u.Email == User.Identity.Name); return(View(user)); }