Пример #1
0
        /// <summary>
        /// Submit a list of attendances for this section.
        /// </summary>
        /// <param name="attendances"></param>
        /// <returns></returns>
        public async Task <bool> SubmitAttendance(List <AttendanceInfo> attendances)
        {
            List <AttendanceInfo> submitted =
                (List <AttendanceInfo>) await WebhostAPICall.GetObjectAsync(String.Format("api/self/section/{0}/attendance", this.Id), typeof(List <AttendanceInfo>), "PUT",
                                                                            typeof(List <AttendanceInfo>), attendances);

            return(submitted.Count == attendances.Count);
        }
Пример #2
0
 public async Task <CommentHeaderInfo> CurrentCommentHeaderAsync()
 {
     try
     {
         return((CommentHeaderInfo)await WebhostAPICall.GetObjectAsync(String.Format("api/self/sections/{0}/comment_header", this.Id), typeof(CommentHeaderInfo)));
     }
     catch (WebException)
     {
         return(await CreateBlankHeaderAsync());
     }
 }
Пример #3
0
 public async Task <CommentInfo> CurrentCommentAsync()
 {
     try
     {
         return((CommentInfo)await WebhostAPICall.GetObjectAsync(String.Format("api/self/sections/{0}/students/{1}/comment", Comments.CommentSettings.CurrentHeaderParagraph.SectionId, this.Id), typeof(CommentHeaderInfo)));
     }
     catch (WebException)
     {
         return(await CreateBlankCommentAsync());
     }
 }
Пример #4
0
        public async static Task <UserInfo> GetCurrent(bool isTeacher = true)
        {
            if (_Current == null && isTeacher)
            {
                _Current = (TeacherInfo)(await WebhostAPICall.GetObjectAsync("api/self", typeof(TeacherInfo)));
            }
            else if (_Current == null)
            {
                _Current = (StudentInfo)await WebhostAPICall.GetObjectAsync("api/self", typeof(StudentInfo));
            }

            return(_Current);
        }
Пример #5
0
 /// <summary>
 /// Get attendances for a particular date.
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 public async Task <List <AttendanceInfo> > GetAttendances(DateTime date)
 {
     return((List <AttendanceInfo>) await WebhostAPICall.GetObjectAsync(String.Format("api/self/sections/{0}/attendance?datebinary={1}", this.Id, date.ToBinary()), typeof(List <AttendanceInfo>)));
 }
Пример #6
0
 /// <summary>
 /// Get today's attendances.
 /// </summary>
 public async Task <List <AttendanceInfo> > AttendancesToday()
 {
     return((List <AttendanceInfo>) await WebhostAPICall.GetObjectAsync(String.Format("api/self/sections/{0}/attendance", this.Id), typeof(List <AttendanceInfo>)));
 }
Пример #7
0
 public async Task <HttpWebResponse> SaveCommentHeaderAsync(String data)
 {
     return(await WebhostAPICall.SendAuthorizedApiRequestAsync(String.Format("api/self/sections/{0}/comment_header", this.Id), "PUT", typeof(String), data));
 }
Пример #8
0
 public async Task <CommentHeaderInfo> CreateBlankHeaderAsync()
 {
     return((CommentHeaderInfo)await WebhostAPICall.GetObjectAsync(String.Format("api/self/sections/{0}/comment_header", this.Id), typeof(CommentHeaderInfo), "PUT", typeof(String), ""));
 }
Пример #9
0
 public async Task <HttpWebResponse> SaveCommentAsync(String data)
 {
     return(await WebhostAPICall.SendAuthorizedApiRequestAsync(String.Format("api/self/sections/{0}/students/{1}/comment", Comments.CommentSettings.CurrentHeaderParagraph.SectionId, this.Id), "PUT", typeof(String), data));
 }
Пример #10
0
 public async Task <List <SectionInfo> > CurrentSections()
 {
     return((List <SectionInfo>) await WebhostAPICall.GetObjectAsync("api/self/sections/current?detailed=true", typeof(List <SectionInfo>)));
 }
Пример #11
0
 public async Task <List <StudentInfo> > Advisees()
 {
     return((List <StudentInfo>) await WebhostAPICall.GetObjectAsync("api/self/advisees", typeof(List <StudentInfo>)));
 }