Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////////////
        //DASHBOARD: MY TOURS
        ////////////////////////////////////////////////////////////////////////////////////////
        public ActionResult Tours(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("Tours", "Band", new { bandId = currentBand.BandId }));
            }
            List <Band> otherBands;

            otherBands = bands.Where(b => b.BandId != bandId).ToList();
            //End of common code

            string chartData = GetAppearanceFeeChartData(currentBand);

            var viewModel = new BandTourViewModel();

            viewModel.ChartData        = chartData;
            viewModel.OtherBands       = otherBands;
            viewModel.CurrentBand      = currentBand;
            viewModel.CurrentBandTours = currentBand.Tours.ToList();
            if (TempData["infoMessage"] != null)
            {
                ViewBag.infoMessage = TempData["infoMessage"].ToString();
            }
            if (TempData["dangerMessage"] != null)
            {
                ViewBag.dangerMessage = TempData["dangerMessage"].ToString();
            }
            return(View(viewModel));
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////////////////
        //DASHBOARD: MY TOURS
        ////////////////////////////////////////////////////////////////////////////////////////
        public ActionResult Tours(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 BandTourViewModel();

            viewModel.OtherBands       = otherBands;
            viewModel.CurrentBand      = currentBand;
            viewModel.CurrentBandTours = currentBand.Tours.ToList();
            if (TempData["infoMessage"] != null)
            {
                ViewBag.infoMessage = TempData["infoMessage"].ToString();
            }
            if (TempData["dangerMessage"] != null)
            {
                ViewBag.dangerMessage = TempData["dangerMessage"].ToString();
            }
            return(View(viewModel));
        }