コード例 #1
0
 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));
 }
コード例 #2
0
        private ContentInsurance ContentInsuranceExists(int id)
        {
            ContentInsurance content = _policyService.GetContentInsurances().Find(c => c.Id == id);

            return(content);
        }