Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="questions">The feedback text</param>
        /// <param name="sessionId">The id of the review session</param>
        /// <param name="current">The username of the API user</param>
        /// <exception cref="SessionNotFoundException"></exception>
        /// <exception cref="InvalidOperationException"></exception>
        /// <exception cref="AuthorizationException"></exception>
        public void ProvideFeedback(int sessionId, List <Question> questions, string current)
        {
            var session = _sessionRepository.Get(sessionId);

            if (session == null)
            {
                throw new SessionNotFoundException();
            }

            if (!(session.Reviewer.ToLower() == current.ToLower() || session.Creator.ToLower() == current.ToLower()))
            {
                throw new AuthorizationException();
            }

            if (!(session.SessionStatus == SessionStatusType.Released || session.SessionStatus == SessionStatusType.Completed))
            {
                throw new InvalidOperationException("User can only provide feedback when the session is in a released or completed state.");
            }

            session.Questions = questions;
            _sessionRepository.Patch(session, ReviewSession.SaveQuestionnairePatch);
        }
 public void UpdateSecurityStatistics(Account account)
 {
     _repository.Patch(account, Account.UpdateSecurityPatch);
 }