Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 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());
 }
Esempio n. 3
0
        public ActionResult Register()
        {
            ViewBag.BranchName = DAFacade.GetBranchNameListForDropdown(string.Empty);

            return(View());
        }