Пример #1
0
        public ActionResult CreateCategory()
        {
            var model = new CreateCategoryModel();

            return View(model);
        }
Пример #2
0
        public ActionResult EditCategory(int id = 0)
        {
            var model = new CreateCategoryModel();
            model = _productCategoryService.GetById(id).ToModel();

            return View(model);
        }
Пример #3
0
        public ActionResult EditCategory(CreateCategoryModel model)
        {
            var entity = _productCategoryService.GetById(model.Id);
            entity.CategoryName = model.CategoryName;
            entity.CategoryImage = model.CategoryImage;
            entity.CreatedDate = model.CreatedDate;
            entity.IsFeaturedCategory = model.IsFeatured;

            _productCategoryService.Update(entity);

            return View(model);
        }
Пример #4
0
 public ActionResult CreateCategory(CreateCategoryModel model)
 {
     var entity = model.ToEntity();
     _productCategoryService.Add(entity);
     return RedirectToAction("Index");
 }