示例#1
0
 public ActionResult CreateMarking(Marking marking)
 {
     if (_appUserService.AppUserExcist(marking.UserEmail) && _questionService.QuestionExcist(marking.QuestionId))
     {
         if (_markingService.CreateMarking(marking) != null)
         {
             var question = _questionService.GetMarkedQuestion(marking.QuestionId, marking.UserEmail);
             return(CreatedAtRoute(
                        nameof(GetMarking),
                        new { userEmail = marking.UserEmail, questionId = marking.QuestionId },
                        CreateQuestionDto(question)));
         }
         return(BadRequest("The question is already marked"));
     }
     //User or question doesn't exist
     return(NotFound());
 }