public ActionResult EditAndApproveQuestion(QuestionModel question)
        {
            var userEmailId           = User.Identity.Name;
            var user                  = _containerUserService.FindUserByEmail(userEmailId);
            var isOnHold              = false;
            var isReject              = false;
            var questionStatusDetails = new QuestionStatusDetails();

            if (question.Status == QuestionStatus.OnHold)
            {
                questionStatusDetails.Status = question.ChangeStatusTo != null ? (QuestionStatus)question.ChangeStatusTo : QuestionStatus.Approved;
                question.Status = question.ChangeStatusTo != null ? (QuestionStatus)question.ChangeStatusTo : QuestionStatus.Approved;
                isOnHold        = true;
            }
            else
            {
                questionStatusDetails.Status = QuestionStatus.ReadyForReview;
                question.Status = QuestionStatus.ReadyForReview;
                isReject        = true;
            }
            UpdateQuestion(question);
            questionStatusDetails.QuestionId  = question.Id;
            questionStatusDetails.ChangedBy   = user.ID;
            questionStatusDetails.ChangedDate = DateTime.Now;
            _questionService.AddQuestionStatusDetails(questionStatusDetails);
            return(RedirectToAction("Index", new TabSelectionViewModel {
                QuestionId = question.NextQuestionId, TechnologyId = question.TechnologyId, IsOnHold = isOnHold, IsRejected = isReject
            }));
        }
Exemplo n.º 2
0
 public int?AddQuestionStatusDetails(QuestionStatusDetails statusDetails)
 {
     if (statusDetails != null)
     {
         _context.Add(statusDetails);
         return(statusDetails.Id);
     }
     return(null);
 }
        private void UpdateQuestionStatus(SubmitQuestionReviewViewModel review)
        {
            var userEmailId = User.Identity.Name;
            var user        = _containerUserService.FindUserByEmail(userEmailId);
            var question    = _questionService.GetSingleQuestion(review.QuestionId);

            if (question != null)
            {
                question.Status = review.Status;
                _questionService.Update(question);
                var questionStatusDetails = new QuestionStatusDetails();
                questionStatusDetails.QuestionId  = review.QuestionId;
                questionStatusDetails.Status      = review.Status;
                questionStatusDetails.Comment     = review.Comment;
                questionStatusDetails.ChangedBy   = user.ID;
                questionStatusDetails.ChangedDate = DateTime.Now;
                _questionService.AddQuestionStatusDetails(questionStatusDetails);
            }
        }