Ejemplo n.º 1
0
        public ObservableCollection <CategoryModel> GetAllItems()
        {
            Items   = new ObservableCollection <CategoryModel>();
            RestAPI = new RestAPI();
            List <Category> category = RestAPI.GetCategory();

            if (category == null)
            {
                return(Items);
            }
            foreach (var item in category)
            {
                CategoryModel categoryItem = new CategoryModel()
                {
                    Id           = item.Id,
                    CategoryName = item.Name,
                };
                Items.Add(categoryItem);
            }
            return(Items);
        }