Example #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);
        }
Example #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());
     }
 }
Example #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());
     }
 }
Example #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);
        }
Example #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>)));
 }
Example #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>)));
 }
Example #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));
 }
Example #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), ""));
 }
Example #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));
 }
Example #10
0
 public async Task <List <SectionInfo> > CurrentSections()
 {
     return((List <SectionInfo>) await WebhostAPICall.GetObjectAsync("api/self/sections/current?detailed=true", typeof(List <SectionInfo>)));
 }
Example #11
0
 public async Task <List <StudentInfo> > Advisees()
 {
     return((List <StudentInfo>) await WebhostAPICall.GetObjectAsync("api/self/advisees", typeof(List <StudentInfo>)));
 }