Exemplo n.º 1
0
        public async Task <IActionResult> PostPartner(Partner model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }

            await _partnerManager.AddPartnerAsync(model);

            return(RedirectToAction(nameof(Partners)));
        }