public ActionResult CreateSubCategory(SubCategoryModel model) { if (ModelState.IsValid) { this.subCategoryRepository.Create(model); return this.RedirectToIndex(); } return View(model); }
public ActionResult CreateSubCategory(Guid mainCategoryId) { //TODO: validate if ID exists var subCategoryModel = new SubCategoryModel {MainCategoryId = mainCategoryId}; return View(subCategoryModel); }
public ActionResult DeleteSubCategory(SubCategoryModel model) { var result = this.subCategoryRepository.Delete(model.Id); if (result.IsValid) { return this.RedirectToIndex(); } model.ValidationResults.AddRange(result.ValidationResults); return View(model); }