public ActionResult Schedule() { string title = "Schedule"; Load(title); Dictionary <DateTime, Dictionary <int, char> > schedule; SqlStoredProcedures sqlSP = new SqlStoredProcedures(); if (user == null || (ids != null && ids.ContainsKey("showAll") && Convert.ToBoolean(ids["showAll"]) == true)) { schedule = sqlSP.StoreSelectSchedule(-1); } else { schedule = sqlSP.StoreSelectSchedule(user.GetUserID()); } List <char> stores = new List <char>(); foreach (Dictionary <int, char> shifts in schedule.Values) { foreach (char store in shifts.Values) { if (!stores.Contains(store)) { stores.Add(store); } } } ViewBag.stores = stores; ViewBag.schedule = schedule; return(View(title)); }