public IActionResult Create(CommonViewModel model) { if (ModelState.IsValid) { ContentInsurance newContent = new ContentInsurance { Name = model.addContent.Name, Value = model.addContent.Value, CategoryId = model.addContent.CategoryId }; _policyService.AddContent(newContent); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_policyService.GetCategories(), "Id", "Name", model.addContent.CategoryId); return(View(model)); }
private ContentInsurance ContentInsuranceExists(int id) { ContentInsurance content = _policyService.GetContentInsurances().Find(c => c.Id == id); return(content); }