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