protected void RadGrid1_OnInsertCommand(object sender, GridCommandEventArgs e) { try { var editableItem = ((GridEditableItem)e.Item); var product = new ProductDto(); editableItem.UpdateValues(product); if (product.WeightedItem == null) { product.WeightedItem = false; } var result = ProductOperations.Create(product); if (result.IsSuccess) { this.ShowToast(ToastTypeEnum.Success, "Successfully created Item", "Success"); return; } ShowErrorMessage(result.ErrorMessage); } catch (Exception ex) { ErrorHandler.LogException(ex); ShowErrorMessage("There was a problem Updating the item."); } }
public ActionResult Create(ProductModel vm) { try { var actionModel = new ProductOperations(); actionModel.Create(vm); return(RedirectToAction("Index")); } catch { return(View(new ProductModel())); } }