public ActionResult Index(Calendar calendar) { if ((string) Session["IndexView"] == "Month") Session["IndexView"] = "List"; else Session["IndexView"] = "Month"; return RedirectToAction("Index"); }
// By convention - Get methods return collections of objects, find methods return single objects. public Calendar Find(int userId) { // The Calendar object is a collection of CalendarBase objects Calendar returnValue = new Calendar(); // First, we fill the Personal Items returnValue.Items = (from i in pi.Get(userId) select (CalendarBase) i).ToList(); // First, we fill the Assignments foreach (CalendarBase b in (from i in a.Get(userId) select (CalendarBase)i)) returnValue.Items.Add(b); return returnValue; }