Example #1
0
        public ActionResult Detail(Guid id, ProductCategoryViewModels model)
        {
            var productCategory = _productCategoryService.GetById(id);

            model = new ProductCategoryViewModels(productCategory);
            return(View(model));
        }
Example #2
0
        public ActionResult Edit(ProductCategoryViewModels model)
        {
            var productCategory = new ProductCategory()
            {
                Id           = model.Id,
                Name         = model.Name,
                Image        = model.Image,
                ModifiedDate = DateTime.Now,
                ModifiedBy   = User.Identity.GetUserName()
            };
            var result = _productCategoryService.Update(productCategory);

            if (result == true)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Example #3
0
        public ActionResult Create(ProductCategoryViewModels model)
        {
            var productCategory = new ProductCategory()
            {
                Id           = Guid.NewGuid(),
                Name         = model.Name,
                Image        = model.Image,
                CreateDate   = DateTime.Now,
                CreateBy     = User.Identity.GetUserName(),
                ModifiedDate = DateTime.Now,
                Status       = true,
            };
            var result = _productCategoryService.Create(productCategory);

            if (result == true)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }