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()); }
public OperationResult Edit(EditProductCategory command) { var operation = new OperationResult(); var productCategory = _productCategoryRepository.Get(command.Id); if (productCategory == null) { return(operation.Failed(ApplicationMessages.RecordNotFound)); } if (_productCategoryRepository.Exists(x => x.Name == command.Name && x.Id != command.Id)) { return(operation.Failed(ApplicationMessages.DuplicatedRecord)); } var slug = command.Slug.Slugify(); var picturePath = $"{command.Slug}"; var pictureName = _fileUploader.Upload(command.Picture, picturePath); productCategory.Edit(command.Name, command.Description, pictureName, command.PictureAlt, command.PictureTitle, command.Keywords, command.MetaDescription, slug); _productCategoryRepository.SaveChanges(); return(operation.Succeed()); }
public OperationResult Edit(EditProductCategory command) { OperationResult operationResult = new OperationResult(); var ProductCategory = _productCategoryRepo.Get(command.Id); if (ProductCategory == null) { return(operationResult.Failed(ApplicationMessage.recordNotFound)); } if (_productCategoryRepo.Exists(c => c.Name == command.Name && c.Id != command.Id)) { return(operationResult.Failed(ApplicationMessage.duplicated)); } var Slug = command.Slug.Slugify(); var picpath = $"{command.Slug}"; var Picturename = _fileUploader.Upload(command.picture, picpath); ProductCategory.Edit(command.Name, command.Description, Picturename, command.pictureAlt, command.pictureTitle, command.KeyWords, command.MetaDescription, Slug); _productCategoryRepo.Save(); return(operationResult.Succeeded()); }
public JsonResult OnPostEdit(EditProductCategory command) { if (ModelState.IsValid) { } var result = _productCategoryApplication.Edit(command); return(new JsonResult(result)); }
public void Edit(EditProductCategory command) { var productCategory = _productCategoryRepository.Get(command.Id); if (productCategory != null) { productCategory.Edit(command.Name); _productCategoryRepository.SaveChanges(); } }
public OperationResult Edit(EditProductCategory command) { var operation = new OperationResult(); var productCategory = repo.Get(command.Id); if (productCategory == null) { return(operation.Failed("رکوردی یافت نشد")); } if (repo.Exist(x => x.Name == command.Name && x.Id != command.Id)) { return(operation.Failed("این نام تکراری است. لطفا نام دیگری انتخاب کنید")); } var slug = command.Slug.Slugify(); productCategory.Edit(command.Name, command.Description, command.Picture, command.PictureAlt, command.PictureTitle, command.Keywords, command.MetaDescription, slug); repo.SaveChange(); return(operation.Succedded("ویرایش اطلاعات با موفقیت انجام شد")); }
public OperationResult Edit(EditProductCategory command) { var operationResult = new OperationResult(); var productCategory = _productCategoryRepository.Get(command.Id); if (productCategory == null) { return(operationResult.Failed("چنین رکوردی در دیتابیس موجود نیست.")); } if (_productCategoryRepository.Exists(p => p.Name == command.Name && p.Id != command.Id)) { return(operationResult.Failed("امکان ثبت رکورد تکراری وجود ندارد.")); } var filename = _fileUploader.FileUpload(command.Picture, command.Slug); productCategory.Edit(command.Name, command.Description, filename, command.PictureAlt, command.PictureTitle, command.Keywords, command.MetaDescription, command.Slug.Slugify()); _productCategoryRepository.SaveChanges(); return(operationResult.Succeeded()); }
public OperationResult Edit(EditProductCategory command) { var operation = new OperationResult(); var productCategory = _productCategoryRepository.GetBy(command.Id); if (productCategory == null) { return(operation.Failed("رکوردی با این اطلاعات یافت نشد . محدد تلاش کنید.")); } if (_productCategoryRepository.Exists(x => x.Name == command.Name && x.Id != command.Id)) { return(operation.Failed("امکان ثبت وجود ندارد ، نام تکراری است .")); } _productCategoryRepository.Save(); var slug = command.Name.Slugify(); productCategory.Edit(command.Name, command.Description, command.Picture, command.PictureAlt, command.PictureTitle, command.Keywords, command.MetaDescription, slug); return(operation.Succedded()); }
public JsonResult OnPostEdit(EditProductCategory command) { var result = _productCategoryApplication.Edit(command); return(new JsonResult(result)); }
public void OnGet(int id) { EditProductCategory = _productCategoryApplication.GetDetails(id); }