예제 #1
0
        public IActionResult Create(AdvertCreateViewModel advertViewModel)
        {
            if (ModelState.IsValid)
            {
                var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
                advertRepository.CreateAdvert(advertViewModel, userId);

                flashMessage.Confirmation("Ogłoszenie zostało dodane");
                return(RedirectToAction(nameof(AdvertController.List), nameof(AdvertController).Replace("Controller", "")));
            }
            else
            {
                return(View(advertViewModel));
            }
        }