public ActionResult Add(Question question)
        {
            _questionRepository.Add(question);
            _unitOfWork.Commit();

            return new EmptyResult();
        }
Example #2
0
        //public void DeleteQuestion(int questionId)
        //{
        //    _questionRepository.Delete(questionId);
        //}
        //public void DeleteAnswer(int answerId)
        //{
        //    _questionRepository.Delete(answerId);
        //}
        public bool DeleteAllowed(Question question, Guid userId)
        {
            bool notLoggedIn = userId == Guid.Empty;

            // logged In?
            bool deleteAllowed = !notLoggedIn && (userId == question.OwnerUserId);

            // owner?
            deleteAllowed = question.OwnerUserId == userId;

            return deleteAllowed;
        }
Example #3
0
 public IPresentation Presentate(Question question)
 {
     return new QuestionPresentation
                {
                    DisplayName = question.User != null ? question.User.GetDisplayName() : string.Empty,
                    UserId = question.User != null ? question.User.UserId : Guid.Empty,
                    Date = question.Created.ToFormattedString(),
                    Text = question.Text,
                    ShortText = question.Text.Truncate(100),
                    //NumberOfAnswers = _qaService.GetNumberOfAnswersByQuestion(question.QuestionId).ToString(),
                    QuestionId = question.QuestionID,
                    Title = question.Title
                };
 }
Example #4
0
 public void CreateQuestionInDb(Question question)
 {
     throw new NotImplementedException();
     //_entityQaRepository.CreateQuestionInDb(question);
 }
 public void Delete(Question entity)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public bool DeleteAllowed(Question question, Guid userId)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public void CreateQuestionInDb(Question question)
 {
     throw new NotImplementedException();
 }