Ejemplo n.º 1
0
        public OperationResult Edit(EditProductCategory command)
        {
            OperationResult operationResult = new OperationResult();

            ProductCategory productCategory = _repository.Get(command.Id);

            string sluggish = command.Slug.Slugify();

            if (productCategory == null)
            {
                return(operationResult.Failed(ApplicationMessages.RecordNotFound));
            }

            if (_repository.Exists(c => c.Name == command.Name && c.Id != command.Id))
            {
                return(operationResult.Failed(ApplicationMessages.DuplicatedRecord));
            }

            productCategory.Edit(command.Name, command.Description, command.Picture, command.PictureAlt,
                                 command.PictureTitle, sluggish, command.Keywords, command.MetaDescription);

            _repository.SaveChanges();

            return(operationResult.Succeeded());
        }
Ejemplo n.º 2
0
        public string EditCategory(FormCollection FC)
        {
            ProductCategory PC = new ProductCategory();

            PC.Id           = (int)TempData["PCat"];
            PC.CategoryName = FC["Cat"];
            PC.LastEditBy   = (Session["User"] as User).ID;
            PC.Edit();
            TempData.Keep();
            return("true");
        }