public ActionResult GetMe(AjaxEx data) { var exercise = AllLists.MVCexercise; if (exercise != null) { if (data.Month != null) { if (exercise.Any(a => a.Month == data.Month)) { exercise.Remove(data); } else { exercise.Add(data); ViewBag.ArrData = exercise.ToArray(); ViewBag.Month = new SelectList(AllLists.listItems, "Value", "Key"); return(View()); } } } data.Month = "January"; data.Income = 3000; data.Expense = 2000; exercise.Add(data); ViewBag.ArrData = exercise.ToArray(); ViewBag.Month = new SelectList(AllLists.listItems, "Value", "Key"); return(View()); }
//AJAX Morris Bar Chart in Dynamic Chart public ActionResult graph(AjaxEx d) { var exercise = AllLists.Ajaxexercise; if (exercise != null) { if (d.Month != null) { if (exercise.Any(a => a.Month == d.Month)) { exercise.Remove(d); } else { exercise.Add(d); } exercise.ToArray(); ViewBag.Month = new SelectList(AllLists.listItems, "Value", "Key"); return(Content(JsonConvert.SerializeObject(exercise), "application/json")); } } d.Month = "January"; d.Income = 3000; d.Expense = 2000; if (exercise.Any(a => a.Month == d.Month)) { exercise.Remove(d); } else { exercise.Add(d); } exercise.ToArray(); ViewBag.Month = new SelectList(AllLists.listItems, "Value", "Key"); return(Content(JsonConvert.SerializeObject(exercise), "application/json")); }