Example #1
0
        public async Task <IActionResult> RegisterVendor(RegisterVendorViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                model.UserName = User.Identity.Name;
                var result = _vendorRepository.Create(model, HttpContext.User);
                if (result == Result.Success)
                {
                    _logger.LogInformation("User created a new account with password.");
                    var user = await _vendorRepository.FindByNameAsync(model.VendorName);

                    _logger.LogInformation("User created a new Vendor.");
                    return(RedirectToLocal("/home/index"));
                }
                // AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }