예제 #1
0
 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)));
 }
예제 #2
0
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, InternVM obj)
        {
            if (ModelState.IsValid)
            {
                repository.InternInsert(obj);
            }

            return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
        }
예제 #3
0
 public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, InternVM obj)
 {
     repository.InternDelete(obj);
     return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
 }