// create profile // view profile // GET: Band public ActionResult Index() { Band band = GetUserBand(); if (band == null) { return(RedirectToAction("Create", "Band")); } BandIndexViewModel model = AssembleIndexViewModelForBand(); return(View(model)); }
// HELPER FUNCTIONS public BandIndexViewModel AssembleIndexViewModelForBand() { BandIndexViewModel bandInfo = new BandIndexViewModel(); bandInfo.band = GetUserBand(); bandInfo.currentGigs = GetGigViewModel(GetGigs(bandInfo.band)); // contains Gig, BandsList, Location (formatted) bandInfo.messagesIn = GetAllMessagesIn(bandInfo.band.BandId); bandInfo.messagesOut = GetAllMessagesOut(bandInfo.band.BandId); bandInfo.requestsIn = GetRequestsIn(bandInfo.band.BandId); bandInfo.requestsOut = GetRequestsOut(bandInfo.band.BandId); bandInfo.requestResponses = GetRespondedRequests(bandInfo.band.BandId); bandInfo.reviews = GetBandReviews(bandInfo.band); bandInfo.score = AverageReviews(bandInfo.reviews); return(bandInfo); }