public ActionResult chpie2view(string restcode) { try { if (restcode == null) { restcode = "HN"; } DeliverTime = DateTime.Today.ToString(); Ankapurservices chartl = new Ankapurservices(); var modelCust1 = chartl.chartpie(DeliverTime, restcode); ViewBag.ordertype = String.Join(",", modelCust1.Select(m => m.Ordertype).ToList()); ViewBag.orders1 = String.Join(",", modelCust1.Select(m => m.Orders).ToList()); return(PartialView("chpie2view", modelCust1)); } catch (Exception) { return(Content("<script language='javascript' type='text/javascript'>alert('Restaurant is closed at the moment');location.href='" + @Url.Action("Index", "graph") + "'</script>")); } }