public int AddDetailedCategory(NewDetailedCategoryVm model) { var detCategory = _mapper.Map <DetailedCategory>(model); int id = _detailedCRepo.AddDetailedCategory(detCategory); return(id); }
public IActionResult EditDetailedCategory(NewDetailedCategoryVm model) { if (ModelState.IsValid) { _detailedCService.UpdateDetailedCategory(model); return(RedirectToAction("DetailedCategories", new { mainCategoryId = model.MainCategoryId })); } return(View(model)); }
public NewDetailedCategoryVm GetNewDetailedCategoryToCreate(int mainCategoryId) { var mainCategoryName = _mainCRepo.GetMainCategoryNameById(mainCategoryId); var model = new NewDetailedCategoryVm() { MainCategoryId = mainCategoryId, MainCategoryName = mainCategoryName }; return(model); }
public IActionResult CreateDetailedCategory(NewDetailedCategoryVm model) { var id = _detailedCService.AddDetailedCategory(model); return(RedirectToAction("DetailedCategories", new { mainCategoryId = model.MainCategoryId })); }
public void UpdateDetailedCategory(NewDetailedCategoryVm model) { var detailedCategory = _mapper.Map <DetailedCategory>(model); _detailedCRepo.UpdateDetailedCategory(detailedCategory); }