// GET: api/Categories
        public CategoryListAPIModel Get()
        {
            var apiModel = new CategoryListAPIModel();

            try
            {
                apiModel.Result = service.Get().ToList();
            }
            catch (Exception)
            {
                apiModel.Message = "!OK";
            }
            return(apiModel);
        }
Beispiel #2
0
        public async Task <ActionResult> Index()
        {
            var apiModel = new CategoryListAPIModel();
            {
                var resp = await Get(null, response =>
                {
                    if (response.IsSuccessStatusCode)
                    {
                        var result = response.Content.ReadAsStringAsync().Result;
                        apiModel   = JsonConvert.DeserializeObject <CategoryListAPIModel>(result);
                    }
                });

                return(View(apiModel.Result));
            }
        }