예제 #1
0
        public async Task <IActionResult> Edit(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            HttpResponseMessage res = await _client.GetDataEdit(String.Format(@"/api/QuizDB/{0}", id));

            Question question = new Question();

            if (res.IsSuccessStatusCode)
            {
                string response = res.Content.ReadAsStringAsync().Result;
                question = JsonConvert.DeserializeObject <Question>(response);
            }

            if (question == null)
            {
                return(NotFound());
            }
            return(View(question));
        }