Пример #1
0
        public ActionResult Add(Question question)
        {
            _questionRepository.Add(question);
            _unitOfWork.Commit();

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