Пример #1
0
 public async Task<ActionResult> Create(GroupCreateModel Model)
 {
     if(ModelState.IsValid)
     {
         GroupAddRequest gar = new GroupAddRequest()
         {
             CourseCode = Model.CourseCode,
             GroupCode = Model.CourseCode + DateTime.UtcNow.ToString("MMddyyHmmss"),
             GroupName = Model.GroupName,
             GroupTypeCode = Model.GroupTypeCode,
             Objective = Model.Objective,
             TimeZone = Model.TimeZone,
             userList = new List<string>() { MvcApplication.userEmail }
         };
         bool resp = _groupCom.AddGroup(gar).Result;
         if(resp)
             return RedirectToAction("GroupDetail", "Group", routeValues: new { groupCode = gar.GroupCode });
     }
     ModelState.AddModelError("", "Oops! Something wrong happened! Please try again.");
     return View(Model);
 }
Пример #2
0
 public ActionResult Create(string courseCode)
 {
     GroupCreateModel gcm = new GroupCreateModel();
     CourseGetResponse cgr = _courseCom.GetCourse(courseCode).Result;
     if(cgr != null)
     {
         gcm.GroupTypeCode = cgr.GroupType;
         if (cgr.GroupSize.HasValue)
             gcm.MaxNumberOfUsers = cgr.GroupSize;
     }
     gcm.timeZones = TimeZoneInfo.GetSystemTimeZones().Select(x => x.DisplayName).ToList();
     gcm.CourseCode = courseCode;
     return View(gcm);
 }