public IActionResult AddAdvertisementType(AdvertisementTypeViewModel model)
 {
     if (ModelState.IsValid)
     {
         Service.AddAdvertisementType(model);
         return(RedirectToAction(nameof(AddAdvertisementType)));
     }
     return(Redirect("~/"));
 }
Exemple #2
0
        public AdvertisementType AddAdvertisementType(AdvertisementTypeViewModel viewModel)
        {
            var model = new AdvertisementType
            {
                TypeName = viewModel.AdvertisementType
            };

            _context.Add(model);
            _context.SaveChanges();
            return(model);
        }