Esempio n. 1
0
        public override void execute()
        {
            List <ValueViewModel> list = ApiRef.ApiValuesGet().ToList();

            ImplUtil.PrintList(list);

            Console.WriteLine("Getting Value By Id (2)");
            ValueViewModel model = ApiRef.ApiValuesByIdGet(2);

            Console.WriteLine("Id: " + model.Id + " Name: " + model.Name + " Value: " + model.Value);


            Console.WriteLine("Creating New Value");
            ValueViewModel tmpModel = new ValueViewModel {
                Id = 6, Name = "Test", Value = 6
            };

            ApiRef.ApiValuesPost(tmpModel);
            list = ApiRef.ApiValuesGet().ToList();
            ImplUtil.PrintList(list);

            Console.WriteLine("Updating Value (3)");
            model.Name  = "Ten";
            model.Value = 10;
            ApiRef.ApiValuesByIdPut(2, model);
            list = ApiRef.ApiValuesGet().ToList();
            ImplUtil.PrintList(list);


            Console.WriteLine("Deleting Value (4)");
            ApiRef.ApiValuesByIdDelete(4);
            list = ApiRef.ApiValuesGet().ToList();
            ImplUtil.PrintList(list);
        }
Esempio n. 2
0
		public IEnumerable<CategoryView> FormatCategory(ApiRef.IStore client, IEnumerable<int> categoryIds)
		{
			foreach (var id in categoryIds)
			{
				if (_categoryCache.ContainsKey(id))
				{
					ReadsFromCache++;

					yield return new CategoryView()
					{
						Id = id,
						Name = _categoryCache[id]
					};
				}
				else
				{
					var categoryDisplayName = client.GetCategory(id).Name;
					_categoryCache.Add(id, categoryDisplayName);

					ReadsFromService++;

					yield return new CategoryView()
					{
						Id = id,
						Name = categoryDisplayName
					};
				}
			}
		}
Esempio n. 3
0
        public override void execute()
        {
            List <ValueViewModel> list = new List <ValueViewModel>();

            Task.Run(() =>
            {
                var response = ApiRef.ApiValuesGetAsync();
                list         = response.Result.ToList();
            }).Wait();

            ImplUtil.PrintList(list);

            Console.WriteLine("Getting Value By Id (2)");
            ValueViewModel model = new ValueViewModel();

            Task.Run(() =>
            {
                var response = ApiRef.ApiValuesByIdGetAsync(2);
                model        = response.Result;
            }).Wait();

            Console.WriteLine("Id: " + model.Id + " Name: " + model.Name + " Value: " + model.Value);

            Console.WriteLine("Creating New Value");
            ValueViewModel tmpModel = new ValueViewModel {
                Id = 6, Name = "Test", Value = 6
            };

            Task.Run(() =>
            {
                var response = ApiRef.ApiValuesPostAsync(tmpModel);
            }).Wait();

            list = ApiRef.ApiValuesGet().ToList();
            ImplUtil.PrintList(list);

            Console.WriteLine("Updating Value (3)");
            model.Name  = "Ten";
            model.Value = 10;
            Task.Run(() =>
            {
                var response = ApiRef.ApiValuesByIdPutAsync(2, model);
            }).Wait();


            list = ApiRef.ApiValuesGet().ToList();
            ImplUtil.PrintList(list);

            Console.WriteLine("Deleting Value (4)");
            Task.Run(() =>
            {
                var response = ApiRef.ApiValuesByIdDeleteAsync(4);
            }).Wait();

            list = ApiRef.ApiValuesGet().ToList();
            ImplUtil.PrintList(list);
        }