public async Task <List <DisplayModel> > DisplayModelList(string date, string lang) { DetailAPI detailAPI = new DetailAPI(); List <DisplayModel> dtl = new List <DisplayModel>(); HttpClient client = detailAPI.Initial(); HttpResponseMessage res = await client.GetAsync("SettingMsg/GetSettingMessages?curdate=" + date + "&langcode=" + lang); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; dtl = JsonConvert.DeserializeObject <List <DisplayModel> >(result); } return(dtl); }
public async Task <DisplayModel> DisplayModelList1() { var date = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time")).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); string lang = "E"; HttpCookie cookie = HttpContext.Request.Cookies["Home"]; if (cookie != null && cookie.Value != null) { if (cookie.Value == "en-Us") { lang = "E"; } else { lang = "da"; } } DetailAPI detailAPI = new DetailAPI(); DisplayModel dtl = new DisplayModel(); HttpClient client = detailAPI.Initial(); CommonViewModel.DisplayModels = new DisplayModel(); dtl = GetCookie("DisplayModelLists"); if (dtl != null) { } else { HttpResponseMessage res = await client.GetAsync("SettingMsg/GetSettingMessages?curdate=" + date + "&langcode=" + lang); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; dtl = JsonConvert.DeserializeObject <DisplayModel>(result); AddCookie(dtl); } } // CommonViewModel.DisplayModels = dtl; return(dtl); }
public async Task <TimeModel> GetTime() { DetailAPI detailAPI = new DetailAPI(); TimeModel dtllov = new TimeModel(); HttpClient client = detailAPI.Initial(); var curr = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time")); //var curr = TimeZoneInfo.ConvertTime(DateTime.Now.AddDays(2), TimeZoneInfo.FindSystemTimeZoneById("Romance Standard Time")); string Day = curr.ToString("ddd"); HttpResponseMessage res = await client.GetAsync("RestaurantTiming/GetResTiming?dayname=" + Day + ""); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; dtllov = JsonConvert.DeserializeObject <TimeModel>(result); } return(dtllov); }