Пример #1
0
        public int AddDetailedCategory(NewDetailedCategoryVm model)
        {
            var detCategory = _mapper.Map <DetailedCategory>(model);
            int id          = _detailedCRepo.AddDetailedCategory(detCategory);

            return(id);
        }
Пример #2
0
 public IActionResult EditDetailedCategory(NewDetailedCategoryVm model)
 {
     if (ModelState.IsValid)
     {
         _detailedCService.UpdateDetailedCategory(model);
         return(RedirectToAction("DetailedCategories", new { mainCategoryId = model.MainCategoryId }));
     }
     return(View(model));
 }
Пример #3
0
        public NewDetailedCategoryVm GetNewDetailedCategoryToCreate(int mainCategoryId)
        {
            var mainCategoryName = _mainCRepo.GetMainCategoryNameById(mainCategoryId);
            var model            = new NewDetailedCategoryVm()
            {
                MainCategoryId   = mainCategoryId,
                MainCategoryName = mainCategoryName
            };

            return(model);
        }
Пример #4
0
        public IActionResult CreateDetailedCategory(NewDetailedCategoryVm model)
        {
            var id = _detailedCService.AddDetailedCategory(model);

            return(RedirectToAction("DetailedCategories", new { mainCategoryId = model.MainCategoryId }));
        }
Пример #5
0
        public void UpdateDetailedCategory(NewDetailedCategoryVm model)
        {
            var detailedCategory = _mapper.Map <DetailedCategory>(model);

            _detailedCRepo.UpdateDetailedCategory(detailedCategory);
        }