Beispiel #1
0
 public ActionResult CommodityGrade_Create([DataSourceRequest] DataSourceRequest request,
                                           CommodityGradeViewModel commodityGradeViewModel)
 {
     if (commodityGradeViewModel != null && ModelState.IsValid)
     {
         var commodityGrade = CommodityGradeViewModelBinder.BindCommodityGrade(commodityGradeViewModel);
         _commodityGradeService.AddCommodityGrade(commodityGrade);
     }
     return(Json(new[] { commodityGradeViewModel }.ToDataSourceResult(request, ModelState)));
 }
Beispiel #2
0
        public ActionResult CommodityGrade_Update([DataSourceRequest] DataSourceRequest request,
                                                  CommodityGradeViewModel commodityGradeViewModel)
        {
            if (commodityGradeViewModel != null && ModelState.IsValid)
            {
                var target         = _commodityGradeService.FindById(commodityGradeViewModel.CommodityGradeID);
                var commodityGrade = CommodityGradeViewModelBinder.BindCommodityGrade(commodityGradeViewModel, target);
                _commodityGradeService.EditCommodityGrade(commodityGrade);
            }

            return(Json(new[] { commodityGradeViewModel }.ToDataSourceResult(request, ModelState)));
        }