Beispiel #1
0
 public async Task<ActionResult> AddTheorySchedule(ScheduleTheoryDTO shedule)
 {
     if (Request.IsAjaxRequest())
     {
         int result = await AdminService.AddScheduleTheoryAsync(shedule);                
         if (result > 0)
         {
             var lessons = await AdminService.GetSheduleTheoryAsync(shedule.GroupId);
             if (lessons.Count() > 0)
             {
                 return PartialView("PartialTheoryShedule", lessons);
             }                    
         }
     }
     return HttpNotFound();
 }
Beispiel #2
0
 public async Task<int> AddScheduleTheoryAsync(ScheduleTheoryDTO shedule)
 {
     if (shedule != null)
     {
         ScheduleTheory onAdd = new ScheduleTheory
         {
             DayOfWeek = shedule.DayOfWeek,
             StartTime = shedule.StartTime,
             EndTime = shedule.EndTime,
             InstructorId = shedule.InstructorId,
             GroupId = shedule.GroupId,
         };
         _context.ScheduleTheories.Create(onAdd);
         int result = await _context.SaveAsync();
         return result;
     }
     return 0;
 }