Askme.Domain.Question.AcceptSolution C# (CSharp) 메소드

AcceptSolution() 공개 메소드

public AcceptSolution ( Answer answer ) : void
answer Answer
리턴 void
        public virtual void AcceptSolution(Answer answer)
        {
            lock (localLock)
            {
                if (acceptedAnswer == null)
                {
                    acceptedAnswer = answer;
                    AssignPointForAcceptingAnswer();
                }
                else
                {
                    throw new NotSupportedException("An answer has been already accepted");
                }
            }
        }

Usage Example

예제 #1
0
파일: User.cs 프로젝트: bagheera/askme
 public virtual void AcceptAnswer(Question question,Answer answer)
 {
     if (!question.IsOwner(this))
         throw new NotSupportedException("An answer can be accepted only by the question's owner");
     question.AcceptSolution(answer);
 }