public ActionResult Add(Question question) { _questionRepository.Add(question); _unitOfWork.Commit(); return new EmptyResult(); }
//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 }; }
public void CreateQuestionInDb(Question question) { throw new NotImplementedException(); //_entityQaRepository.CreateQuestionInDb(question); }
public void Delete(Question entity) { throw new NotImplementedException(); }
public bool DeleteAllowed(Question question, Guid userId) { throw new NotImplementedException(); }
public void CreateQuestionInDb(Question question) { throw new NotImplementedException(); }