コード例 #1
0
        // Ready
        private async Task PostAttendanceAsync()
        {
            //AttendButtonPlaying = true;

            var postUrl = "https://altaarefapp.azurewebsites.net/api/StudyGroupAttendants";

            var sga = new StudyGroupAttendants {
                StudentId = Settings.StudentId, StudyGroupId = StudyGroupView.StudyGroupId
            };

            var content  = new StringContent(JsonConvert.SerializeObject(sga), Encoding.UTF8, "application/json");
            var response = _client.PostAsync(postUrl, content);

            var StudyGroupInserted = JsonConvert.DeserializeObject <StudyGroupAttendants>(await response.Result.Content.ReadAsStringAsync());


            if (response.Result.IsSuccessStatusCode)
            {
                //await _pageService.DisplayAlert("Add Attendant", "You have been added to the Group. ", "OK", "Cancel");
            }
            else
            {
                //await _pageService.DisplayAlert("Error", "Something went wrong with Add Study Group attendant", "OK", "Cancel");
            }
        }
コード例 #2
0
        public async Task <IActionResult> PostStudyGroupAttendants([FromBody] StudyGroupAttendants studyGroupAttendants)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.StudyGroupAttendants.Add(studyGroupAttendants);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStudyGroupAttendants", new { id = studyGroupAttendants.Id }, studyGroupAttendants));
        }
コード例 #3
0
        private async void PostAttendance(StudyGroupAttendants attendant)
        {
            Busy = true;
            var postUrl = "https://altaarefapp.azurewebsites.net/api/StudyGroupAttendants";

            var content  = new StringContent(JsonConvert.SerializeObject(attendant), Encoding.UTF8, "application/json");
            var response = _client.PostAsync(postUrl, content);

            if (response.Result.IsSuccessStatusCode)
            {
                //await _pageService.DisplayAlert("Students Invited", "Students Invited Successfully", "OK", "Cancel");
            }
            else
            {
                await _pageService.DisplayAlert("Error", "Something went wrong with Posting Attendants", "OK", "Cancel");
            }

            Busy = false;
        }
コード例 #4
0
        public async Task <IActionResult> PutStudyGroupAttendants([FromRoute] int id, [FromBody] StudyGroupAttendants studyGroupAttendants)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != studyGroupAttendants.Id)
            {
                return(BadRequest());
            }

            _context.Entry(studyGroupAttendants).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudyGroupAttendantsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }