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

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