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

            return new EmptyResult();
        }
Exemple #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;
        }
 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
                };
 }
Exemple #4
0
 public void CreateQuestionInDb(Question question)
 {
     throw new NotImplementedException();
     //_entityQaRepository.CreateQuestionInDb(question);
 }
 public void Delete(Question entity)
 {
     throw new NotImplementedException();
 }
Exemple #6
0
 public bool DeleteAllowed(Question question, Guid userId)
 {
     throw new NotImplementedException();
 }
Exemple #7
0
 public void CreateQuestionInDb(Question question)
 {
     throw new NotImplementedException();
 }