public ActionResult DestroyTmc([DataSourceRequest] DataSourceRequest request, TmcViewModel dictionary) { TmcRepository repo = new TmcRepository(false); ApplicationPoaRepository poaRepo = new ApplicationPoaRepository(false); if (dictionary != null) { var limsTmcTemp = poaRepo.GetLimsTmcTemps(ltt => ltt.TmcId == dictionary.Id && ltt.TmcInId == dictionary.TmcInId).FirstOrDefault(); poaRepo.DeleteLimsTmcTemp(limsTmcTemp); poaRepo.Save(); Tmc d = repo.GetAsQuarable(o => o.Id == dictionary.Id).First(); repo.Delete(d); repo.Save(); } return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState))); }