Example #1
0
        public ActionResult Gig(int id)
        {
            Gig gig = new Gig();
            List <Timeframe> timeframes = new List <Timeframe>();

            System.Diagnostics.Debug.WriteLine("Calling API now...");
            HttpResponseMessage response = ApiUtilities.PerformApiCall <Gig>(id);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                HttpResponseMessage response1 = ApiUtilities.PerformApiCall <Timeframe>();

                if (response1.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var timeframeTask = response1.Content.ReadAsAsync(timeframes.GetType());
                    timeframes = (List <Timeframe>)timeframeTask.Result;

                    ViewBag.Timeframes = timeframes;

                    var gigTask = response.Content.ReadAsAsync(gig.GetType());
                    gig = (Gig)gigTask.Result;

                    return(View("GigDetails", gig));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            else
            {
                return(HttpNotFound());
            }
        }