// GET api/<controller> public IEnumerable <Session> Get() { //Get Session Manager ScheduleManager sessMgr = new ScheduleManager(); //Get All Sessions var allSessions = sessMgr.GetAllSessions(); //Return all Sessions return(allSessions); }
// GET: Schedule public ActionResult Index() { //Build ScheduleManager ScheduleManager schMgr = new ScheduleManager(); //Get Sessions from Manager IQueryable <Session> allSessions; allSessions = schMgr.GetAllSessions(); //Build ViewModels of Sessions List <SessionViewModel> sessionVM = new List <SessionViewModel>(); foreach (Session p in allSessions) { sessionVM.Add(new SessionViewModel(p)); } //Send Session View Models to View return(View(sessionVM)); }