public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser() { UserName = model.UserName, BranchCode = model.BranchCode }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { // await SignInAsync(user, isPersistent: false); //return RedirectToAction("Index", "Home"); } else { AddErrors(result); } } ViewBag.BranchName = DAFacade.GetBranchNameListForDropdown(string.Empty); // If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult BatchView() { if (HttpContext.User.Identity.Name.ToLower() == "admin") { ViewBag.BranchName = DAFacade.GetBranchNameListForDropdown(string.Empty); } else { ApplicationDbContext _ctx = new ApplicationDbContext(); ApplicationUser branchCode = _ctx.Users.Where(u => u.UserName == HttpContext.User.Identity.Name).FirstOrDefault(); ViewBag.BranchName = DAFacade.GetBranchNameListForDropdown(string.Format("BranchCode='{0}'", branchCode.BranchCode)); } return(View()); }
public ActionResult Register() { ViewBag.BranchName = DAFacade.GetBranchNameListForDropdown(string.Empty); return(View()); }