public ActionResult AddTrialVisitMaterial([DataSourceRequest] DataSourceRequest request, TrialVisitMaterial trialVisitMaterial) { if (trialVisitMaterial != null && ModelState.IsValid) { DataProvider.Add(trialVisitMaterial); } var material = DataProvider.GetItem(new TrialMaterialDataFilter { Id = trialVisitMaterial.TrialMaterialId }); return Json(new[] { TrialVisitMaterialViewModel.Create(trialVisitMaterial, material == null ? null : material.Name )} .ToDataSourceResult(request, ModelState)); }
public static TrialVisitMaterialViewModel Create(TrialVisitMaterial material, string materialName) { return new TrialVisitMaterialViewModel { Id = material.Id, MaterialName = materialName, //Quantity = material.Quantity, TrialCode = material.TrialCode, TrialMaterialId = material.TrialMaterialId, TrialVisitProcedureId = material.TrialVisitProcedureId }; }
public ActionResult DeleteTrialVisitMaterial([DataSourceRequest] DataSourceRequest request, TrialVisitMaterial trialVisitMaterial) { if (trialVisitMaterial != null) { DataProvider.Delete(trialVisitMaterial); } return Json(new[] { trialVisitMaterial }.ToDataSourceResult(request, ModelState)); }