public async Task <IActionResult> Create(AdvertisementFormModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Categories = this.category
                                   .All()
                                   .Select(c => new SelectListItem
                {
                    Text  = c.Name,
                    Value = c.Id.ToString()
                });

                return(View(model));
            }

            var userId = this.userManager.GetUserId(this.User);

            await advertisement.Create(
                model.Name,
                model.Description,
                model.Price,
                DateTime.UtcNow,
                model.CategoryId,
                userId);

            TempData.AddSuccessMessage(string.Format(WebConstants.SuccessMessageAdvertisementCreate, model.Name));
            return(RedirectToAction(nameof(All)));
        }
        public IActionResult Create()
        {
            var model = new AdvertisementFormModel
            {
                Categories = this.category
                             .All()
                             .Select(c => new SelectListItem
                {
                    Text  = c.Name,
                    Value = c.Id.ToString()
                })
            };

            return(View(model));
        }