Exemple #1
0
        public async Task <ActionResult> EditHomework(HomeworkDto homeworkDto)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View("Edit", homeworkDto));
                }
                await _homeworkService.EditHomeworkAsync(homeworkDto);

                return(RedirectToAction("Index", "Homework", new { subjectId = homeworkDto.SubjectId }));
            }
            catch (SPCException ex)
            {
                return(View("ErrorView", new ErrorDto(ex.Message, ex.StatusCode)));
            }
            catch (Exception ex)
            {
                return(View("ErrorView", new ErrorDto(ex.Message, 500)));
            }
        }
 public async Task <IActionResult> Edit([FromBody] HomeworkDto homeworkDto)
 {
     return(await HandleRequestAsync(async() => await _homeworkService.EditHomeworkAsync(homeworkDto)));
 }