Beispiel #1
0
        public async Task <ActionResult> BookManager(int?id)
        {
            Book          book;
            BookViewModel bookModel = new BookViewModel();

            if (id.HasValue)
            {
                HttpClient          httpClient          = this.GetHttp();
                HttpResponseMessage httpResponseMessage = await httpClient.GetAsync(String.Format("api/Book/GetBook/{0}", id));

                if (httpResponseMessage.IsSuccessStatusCode)
                {
                    var EmpResponse = httpResponseMessage.Content.ReadAsStringAsync().Result;

                    book = JsonConvert.DeserializeObject <Book>(EmpResponse);

                    if (book != null)
                    {
                        bookModel.Load(book);
                    }
                }
            }

            return(View(bookModel));
        }