예제 #1
0
        public void Authorization(Authorization authorization)
        {
            try
            {
                Connect();
            }
            catch (Exception e)
            {
                Error(e);
                Disconnect();
                return;
            }

            var request = JsonSerializer.Serialize(new Request {
                Type = RequestType.Authorization, Data = JsonSerializer.Serialize(authorization)
            });

            SendRequest(request);
        }
예제 #2
0
파일: Server.cs 프로젝트: GrishinM/Bank
        public AuthorizationResult Authorize(Authorization authorization)
        {
            AuthorizationResult result;
            var card = dataBase.GetCardById(authorization.CardId);

            if (card.Password == authorization.Password)
            {
                result = new AuthorizationResult {
                    Success = true
                }
            }
            ;
            else
            {
                result = new AuthorizationResult {
                    Success = false, Message = "Неверный пин-код"
                }
            };
            return(result);
        }