Ejemplo n.º 1
0
        public JsonResult GetCaTimelineModel(int caId)
        {
            HttpClient httpClient = ApiHttpClient.GetHttpClient();

            HttpResponseMessage response = httpClient.GetAsync($"api/xspeditionapi/catimeline/{caId}").Result;

            if (!response.IsSuccessStatusCode)
            {
                return(Json(new { Error = "Data Not retrieved successfully." }, JsonRequestBehavior.AllowGet));;
            }

            string responseContent         = response.Content.ReadAsStringAsync().Result;
            CaTimelineViewModel caTimeline = JsonConvert.DeserializeObject <CaTimelineViewModel>(responseContent);

            return(Json(caTimeline, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetCaTimeline(int caId)
        {
            CaTimelineViewModel caTimelineModel = new CaTimelineViewModel {
                CaId = caId, TimelineDateFields = new List <TimelineField>(), CaProcessViewModels = new List <CaProcessViewModel>()
            };

            CaTimeline caTimeline = _context.CaTimeline.FirstOrDefault(ct => ct.CaId == caId);

            if (caTimeline != null)
            {
                caTimelineModel.TimelineRegions = caTimeline;
            }

            AppendCaProcessViewModels(caId, caTimelineModel.CaProcessViewModels);

            AppendRelevantCaTimelineFields(caId, caTimelineModel.TimelineDateFields);

            return(Ok(caTimelineModel));
        }