public AuthResult Authorise(string id)
        {
            var result = _service.RequestAuthorisation(id);

            if (result.StatusCode != (int)HttpStatusCode.OK)
            {
                return new AuthResult(null, result.StatusCode);
            }

            var startDate = DateTime.Parse(result.Auth.start[0].date + "T" + result.Auth.start[0].time,  null, DateTimeStyles.RoundtripKind);
            var start = startDate.ToString("dd-MM-yyyyTHH:mm:ss");

            var endDateTime = startDate.AddMilliseconds(double.Parse(result.Auth.expireafter));
            var end = endDateTime.ToString("dd-MM-yyyyTHH:mm:ss");

            var vidauthAvailble = new vidauthAvailable {start = start, end = end};

            var vidAuth = new vidauth
                {
                    id = id,
                    authid = result.Auth.id,
                    available = new [] { vidauthAvailble }
                };

            var authResult = new AuthResult(vidAuth, (int)HttpStatusCode.OK);

            return authResult;
        }
예제 #2
0
        public vidauth Authorise(string id)
        {
            var auth = _service.RequestAuthorisation(id);

            var startDate = DateTime.Parse(auth.start[0].date + "T" + auth.start[0].time, null, DateTimeStyles.RoundtripKind);
            var start     = startDate.ToString("dd-MM-yyyyTHH:mm:ss");

            var endDateTime = startDate.AddMilliseconds(double.Parse(auth.expireafter));
            var end         = endDateTime.ToString("dd-MM-yyyyTHH:mm:ss");

            var vidauthAvailble = new vidauthAvailable {
                start = start, end = end
            };

            var vidAuth = new vidauth
            {
                id        = id,
                authid    = auth.id,
                available = new [] { vidauthAvailble }
            };

            return(vidAuth);
        }