Exemplo n.º 1
0
        public ActionResult Add(Question question)
        {
            _questionRepository.Add(question);
            _unitOfWork.Commit();

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