Exemplo n.º 1
0
        public async Task <ResultVM> SubscribeStudents(SubscribeStudentsVM studentVMs)
        {
            try
            {
                ResultVM model = await HttpMethods <SubscribeStudentsVM> .PostAsync(Client, studentVMs, "/subscribeStudents");

                return(model);
            }
            catch (Exception e)
            {
                return(new ResultVM
                {
                    Status = Status.Error,
                    Message = e.Message
                });
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SubscribeStudents([FromForm] List <StudentVM> studentVMs, string courseid)
        {
            SubscribeStudentsVM subscribeStudentsVM = new SubscribeStudentsVM
            {
                Students = studentVMs,
                CourseId = courseid
            };

            var result = await _teacherClient.SubscribeStudents(subscribeStudentsVM);

            if (result.Status == Status.Error)
            {
                ViewData["subscribeStudentsErrorMessage"] = result.Message;
                return(RedirectToAction("SubscribeStudents", new { courseid }));
            }

            return(RedirectToAction("ShowStudents", new { courseid }));
        }