public ActionResult Update(ProductItemModel productItemModel) { try { if (IsUpdate(productItemModel.OperationResult)) { if (IsValid(productItemModel.OperationResult, productItemModel.Product)) { Product product = (Product)productItemModel.Product.ToData(); if (Application.Update(productItemModel.OperationResult, product)) { if (productItemModel.IsSave) { return(JsonResultSuccess(productItemModel.OperationResult, Url.Action("Update", "Product", new { ProductId = product.ProductId }, Request.Url.Scheme))); } else { return(JsonResultSuccess(productItemModel.OperationResult)); } } } } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } productItemModel.ActivityOperations = ActivityOperations; return(JsonResultOperationResult(productItemModel.OperationResult)); }
public ActionResult Delete(int?productId, int?masterCategoryId = null, int?masterSupplierId = null) { ProductItemModel productItemModel = new ProductItemModel() { IsSecurityOperations = this.IsSecurityOperations, Product = new ProductViewModel(), ControllerAction = "Delete", MasterCategoryId = masterCategoryId, MasterSupplierId = masterSupplierId }; try { ProductDTO productDTO = Application.GetById(productItemModel.OperationResult, new object[] { productId }); if (productDTO != null) { productItemModel.Product = new ProductViewModel(productDTO); } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } return(PartialView(productItemModel)); }
public ActionResult Delete(ProductItemModel productItemModel) { try { if (Application.Delete(productItemModel.OperationResult, (ProductDTO)productItemModel.Product.ToDTO())) { return(JsonResultSuccess(new { uri = ReadUrlDictionary() })); } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } return(JsonResultOperationResult(productItemModel.OperationResult)); }
public ActionResult Create(string masterEntity = null, string masterKey = null) { ProductItemModel productItemModel = new ProductItemModel(ActivityOperations, "Create", masterEntity, masterKey); try { if (IsCreate(productItemModel.OperationResult)) { return(ZPartialView("CRUD", productItemModel)); } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } return(JsonResultOperationResult(productItemModel.OperationResult)); }
public ActionResult Create(ProductItemModel productItemModel) { try { if (ValidateModelState(Application.Repository)) { if (Application.Create(productItemModel.OperationResult, (ProductDTO)productItemModel.Product.ToDTO())) { return(JsonResultSuccess(new { uri = ReadUrlDictionary() })); } } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } return(JsonResultOperationResult(productItemModel.OperationResult)); }
public ActionResult Delete(ProductItemModel productItemModel) { try { if (IsDelete(productItemModel.OperationResult)) { if (Application.Delete(productItemModel.OperationResult, (Product)productItemModel.Product.ToData())) { return(JsonResultSuccess(productItemModel.OperationResult)); } } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } productItemModel.ActivityOperations = ActivityOperations; return(JsonResultOperationResult(productItemModel.OperationResult)); }
public ActionResult Create(int?masterCategoryId = null, int?masterSupplierId = null) { ProductItemModel productItemModel = new ProductItemModel() { IsSecurityOperations = this.IsSecurityOperations, Product = new ProductViewModel(), ControllerAction = "Create", MasterCategoryId = masterCategoryId, MasterSupplierId = masterSupplierId }; try { IsCreate(productItemModel.OperationResult); } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } return(PartialView(productItemModel)); }
public ActionResult Delete(int productId, string masterEntity = null, string masterKey = null) { ProductItemModel productItemModel = new ProductItemModel(ActivityOperations, "Delete", masterEntity, masterKey); try { if (IsDelete(productItemModel.OperationResult)) { Product product = Application.GetById(productItemModel.OperationResult, new object[] { productId }); if (product != null) { productItemModel.Product = new ProductViewModel(product); return(ZPartialView("CRUD", productItemModel)); } } } catch (Exception exception) { productItemModel.OperationResult.ParseException(exception); } return(JsonResultOperationResult(productItemModel.OperationResult)); }