예제 #1
0
 public async Task<string> AddGroupAsync(GroupForCreate group)
 {
     if (group != null)
     {
         var trPr = await _context.TrainingPrograms.GetAsync(group.TrainingProgramId);
         if (trPr != null)
         {
             Group grAdd = new Group
             {
                 TrainingProgramId = group.TrainingProgramId,
                 GroupType = group.GroupType,
                 TheoryStartDate = group.TheoryStartDate,
                 TheoryEndDate = group.TheoryEndDate,
                 PracticeStartDate = group.PracticeStartDate,
                 PracticeEndDate = group.PracticeEndDate,
             };
             _context.Groups.Create(grAdd);
             
             int result = await _context.SaveAsync();
             if (result > 0)
             {
                 return grAdd.GroupName;
             }
         }                
     }
     return null;
 }
예제 #2
0
 public async Task<ActionResult> AddGroup(GroupForCreate group)
 {
     if (Request.IsAjaxRequest())
     {
         var gr = await AdminService.AddGroupAsync(group);
         if (gr != null)
         {
             ViewBag.Status = "Группа " + gr + " успешно добавлена.";
             return PartialView("Success");
         }
     }
     return HttpNotFound();
 }