예제 #1
0
        public async Task <IActionResult> Branches(BranchViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await _userManager.GetUserAsync(User);

            model.ActionBy = user.UserName;
            Result         = await _setupService.CreateBranchAsync(model);

            if (Result)
            {
                StatusMessage = _config.GetSection("Messages")["Success"];
                return(RedirectToAction(nameof(Branches)));
            }

            StatusMessage = "Error: Unable to create branch";
            return(View(model));
        }