public ActionResult AddCost([DataSourceRequest] DataSourceRequest request, ConfigDeliveryCostModel model) { try { if (model != null) { var service = new ConfigDeliveryCostService(); var product = DataTransfer.Transfer<Config_Delivery_Cost>( model, typeof(ConfigDeliveryCostModel)); model.ID = service.Add(product); } return Json(new[] { model }.ToDataSourceResult(request, ModelState)); } catch { return View(); } }
public ActionResult ModifyCost([DataSourceRequest] DataSourceRequest request, ConfigDeliveryCostModel model) { if (model != null && ModelState.IsValid) { var service = new ConfigDeliveryCostService(); var cost = DataTransfer.Transfer<Config_Delivery_Cost>( model, typeof(ConfigDeliveryCostModel)); service.Modify(cost); } return Json(new[] { model }.ToDataSourceResult(request, ModelState)); }