コード例 #1
0
ファイル: ChatValidation.cs プロジェクト: kirill-shevch/Lume
        public (bool ValidationResult, string ValidationMessage) ValidateGetChat(Guid chatUid, int pageNumber, int pageSize, Guid personUid)
        {
            if (!_chatRepository.CheckChatExistence(chatUid).Result)
            {
                return(false, ErrorDictionary.GetErrorMessage(19, _culture));
            }
            if (pageNumber < 1)
            {
                return(false, ErrorDictionary.GetErrorMessage(28, _culture));
            }
            if (pageSize < 1)
            {
                return(false, ErrorDictionary.GetErrorMessage(29, _culture));
            }
            var personChatList = _chatLogic.GetPersonChatList(personUid).Result;

            if (!personChatList.Any(x => x.ChatUid == chatUid))
            {
                return(false, ErrorDictionary.GetErrorMessage(20, _culture));
            }
            return(true, string.Empty);
        }