//////////////////////////////////////////////////////////////////////////////////////// //DASHBOARD: MY SET LISTS //////////////////////////////////////////////////////////////////////////////////////// public ActionResult SetLists(int?bandId) { //Common code for all actions in BandController CheckSubscription(); var bands = GetUserBands(); if (bands.Count <= 0) { return(RedirectToAction("Create")); } Band currentBand = bands[0]; if (bandId != null) { currentBand = bands.Where(b => b.BandId == bandId).FirstOrDefault(); } else { return(RedirectToAction("SetLists", "Band", new { bandId = currentBand.BandId })); } List <Band> otherBands; otherBands = bands.Where(b => b.BandId != bandId).ToList(); //End of common code var viewModel = new BandSetListViewModel(); viewModel.OtherBands = otherBands; viewModel.CurrentBand = currentBand; viewModel.CurrentBandSetLists = currentBand.SetLists.ToList(); if (TempData["infoMessage"] != null) { ViewBag.infoMessage = TempData["infoMessage"].ToString(); } if (TempData["dangerMessage"] != null) { ViewBag.dangerMessage = TempData["dangerMessage"].ToString(); } return(View(viewModel)); }
//////////////////////////////////////////////////////////////////////////////////////// //DASHBOARD: MY SET LISTS //////////////////////////////////////////////////////////////////////////////////////// public ActionResult SetLists(int?bandId) { //Common code for all actions in BandMemberController List <Band> bands = GetAllBands(); List <Band> myBands = GetUserBands(bands); List <Invitation> invitations = GetInvitations(); CheckInvitationStatus(myBands, invitations); Band currentBand = myBands[0]; if (bandId != null) { currentBand = bands.Where(b => b.BandId == bandId).FirstOrDefault(); } else { return(RedirectToAction("Index", "BandMember", new { bandId = currentBand.BandId })); } List <Band> otherBands = myBands.Where(b => b.BandId != bandId).ToList(); //end of common code //////////////////////////////////////////////////// var viewModel = new BandSetListViewModel(); viewModel.OtherBands = otherBands; viewModel.CurrentBand = currentBand; viewModel.CurrentBandSetLists = currentBand.SetLists.ToList(); if (TempData["infoMessage"] != null) { ViewBag.infoMessage = TempData["infoMessage"].ToString(); } if (TempData["dangerMessage"] != null) { ViewBag.dangerMessage = TempData["dangerMessage"].ToString(); } return(View(viewModel)); }