public ActionResult Update([DataSourceRequest] DataSourceRequest request, InternVM obj) { if (ModelState.IsValid) { repository.InternUpdate(obj); } else { // app is generating an error when binding the StartTime and EndTime // but like those properties are managed in the nested grid they're being ignored here int count = 0; foreach (var key in ModelState.Keys) { if (!key.Contains("StartTime") && !key.Contains("EndTime")) { if (ModelState[key].Errors.Count > 0) { count++; } } } if (count == 0) { obj.Schedules = repository.GetAllScheduleByIntern(obj); repository.InternUpdate(obj); } } return(Json(new[] { obj }.ToDataSourceResult(request, ModelState))); }
public ActionResult Create([DataSourceRequest] DataSourceRequest request, InternVM obj) { if (ModelState.IsValid) { repository.InternInsert(obj); } return(Json(new[] { obj }.ToDataSourceResult(request, ModelState))); }
public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, InternVM obj) { repository.InternDelete(obj); return(Json(new[] { obj }.ToDataSourceResult(request, ModelState))); }