public ActionResult cbpview(string restcode) { try { //string DeliverTime; if (restcode == null) { restcode = "HN"; } DeliverTime = DateTime.Today.ToString(); Ankapurservices chartl = new Ankapurservices(); var modelCust2 = chartl.chartbar(DeliverTime, restcode); //ViewBag.time = modelCust.Select(m => Convert.ToDateTime(m.OrderDate).ToString("yyyy-MM-dd")).ToList(); var data = String.Join(",", modelCust2.Select(m => Convert.ToDateTime(m.month).ToString("MMMM-yyyy")).ToList()); //ViewBag.time = String.Join(",", modelCust.Select(m => Convert.ToDateTime(m.OrderDate).ToString("MMM dd")).ToList()); //var date1 = data.Split(','); var result = string.Join(",", data); ViewBag.time2 = result; ViewBag.orders2 = String.Join(",", modelCust2.Select(m => m.count).ToList()); return(PartialView("cbpview", modelCust2)); } catch (Exception) { return(Content("<script language='javascript' type='text/javascript'>alert('Restaurant is closed at the moment');location.href='" + @Url.Action("Index", "graph") + "'</script>")); } }