Ejemplo n.º 1
0
        protected async override Task <object> OnPerform()
        {
            var response = new HttpResponseMessage();

            if (_isInitializingPump)
            {
                response = await _fuelPumpRestClient.InitializeFuelPump();
            }
            else
            {
                response = await _fuelPumpRestClient.GetPumpStatus(_tillNumber);
            }

            var data = await response.Content.ReadAsStringAsync();

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                var contract = new DeSerializer().MapInitializeFuelPump(data);
                return(new Mapper().MapInitializeFuelPump(contract));

            default:
                return(await HandleExceptions(response));
            }
        }