예제 #1
0
        public bool CanMarkAsAnswer(Question question, string userName)
        {
            if(question.IsClosed())
            {
                ErrorMessage = "Question is already closed";
                return false;
            }

            if (question.IsOwner(userName) || question.IsTaker(userName) || _roles.IsUserInRole(userName, UserRoles.Administrators))
                return true;

            ErrorMessage = "You do not have access to mark this question as answered";
            return false;
        }
예제 #2
0
        public bool CanTake(Question question, string userName)
        {
            if(!question.IsTaken())
                return true;

            if(!question.IsTaker(userName))
            {
                ErrorMessage =
                    "The question you have selected has been taken by another attorney and is no longer available";

                return false;
            }

            ErrorMessage = "You have already taken this question";

            return false;
        }
예제 #3
0
        public bool HasReplyAccess(Question question, string userName)
        {
            if(question.IsClosed())
            {
                ErrorMessage = "Question is closed";
                return false;
            }

            if(_roles.IsUserInRole(userName, UserRoles.Administrators))
                return true;

            if(question.IsTaker(userName))
                return true;

            if (!question.IsTaker(userName))
                ErrorMessage = "The question must be taken before replying or it has already been taken by someone else";

            return false;
        }