Exemplo n.º 1
0
        public bool syncDrawType_ServerToLocal()
        {
            bool successProcess = true;
            // Realizar la petición http
            ServerConnectionService connection     = new ServerConnectionService();
            ServiceResponseResult   responseResult = connection.getDrawTypesFromServer();

            successProcess = this.isValidResponse(responseResult);
            if (successProcess)
            {
                string result = responseResult.result.ToString();
                // Parsear el json de respuesta
                JsonObjectParser parser           = new JsonObjectParser((int)EntityType.DrawType);
                string           parsedJsonString = parser.parse(result);
                // Realizar la persistencia de los cambios
                LotteryDrawTypeRepository drawTypeRepo = new LotteryDrawTypeRepository();
                drawTypeRepo.saveList(JsonConvert.DeserializeObject <List <LDT_LotteryDrawType> >(parsedJsonString));
            }
            return(successProcess);
        }