Exemple #1
0
        public void SaveList(List <Object> lista, string filename)
        {
            var serializerService = new SerializerService();
            var jsonFilename      = filename;
            var list = lista;

            serializerService.Serialize(jsonFilename, list);
        }
Exemple #2
0
        public void AddItemToList(Object Item, String filename)
        {
            var item = Item;
            var serializerService = new SerializerService();
            var jsonFilename      = filename;
            var lista             = serializerService.Deserialize(jsonFilename);

            lista.Add(item);
            serializerService.Serialize(jsonFilename, lista);
        }
Exemple #3
0
        public void RemoveItemFromList(Object Item, String filename)
        {
            var item = Item;
            var serializerService = new SerializerService();
            var jsonFilename      = filename;
            var lista             = serializerService.Deserialize(jsonFilename);

            lista.Remove(item);
            serializerService.Serialize(jsonFilename, lista);
        }
Exemple #4
0
        public List <Object> GetList(String filename)
        {
            var serializerService = new SerializerService();
            var jsonFilename      = filename;


            if (File.Exists(jsonFilename))
            {
                var list = serializerService.Deserialize(jsonFilename);

                return(list);
            }

            else
            {
                var list = new List <Object>();
                serializerService.Serialize(jsonFilename, list);
                return(list);
            }
        }
Exemple #5
0
        public async Task <List <Object> > GetCategoryList(String filename)
        {
            var serializerService = new SerializerService();
            var jsonFilename      = filename;


            if (File.Exists(jsonFilename))
            {
                var list = await serializerService.DeserializeCategory(jsonFilename);

                return(list);
            }

            else
            {
                var list = new List <Object>();
                serializerService.Serialize(jsonFilename, list);
                return(list);
            }
        }