Beispiel #1
0
        public ActionResult Edit(int gigId)
        {
            GigInfoViewModel model = new GigInfoViewModel();

            model.gig   = GetGigFromId(gigId);
            model.bands = GetBandsOnGig(model.gig);

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Details(int gigId)
        {
            GigInfoViewModel model = new GigInfoViewModel();

            model.gig   = GetGigFromId(gigId);
            model.bands = GetBandsOnGig(model.gig);
            Location location = context.Locations.Where(l => l.LocationId == model.gig.Venue.LocationId).FirstOrDefault();

            model.formattedAddress = GeoCode.FormatAddress(location);

            return(View(gigId));
        }
Beispiel #3
0
        public async Task <ActionResult> Edit(GigInfoViewModel model)
        {
            Gig gigToEdit = GetGigFromId(model.gig.GigId);

            gigToEdit.open        = model.gig.open;
            gigToEdit.timeOfGig   = model.gig.timeOfGig;
            gigToEdit.venueId     = model.gig.venueId;
            gigToEdit.description = model.gig.description;
            await context.SaveChangesAsync();

            return(RedirectToAction("Index", "Home"));
        }
        public List <GigInfoViewModel> GetGigViewModel(List <Gig> gigs)
        {
            List <GigInfoViewModel> gigModels = new List <GigInfoViewModel>();

            foreach (Gig gig in gigs)
            {
                GigInfoViewModel tempGigModel = new GigInfoViewModel();
                tempGigModel.gig   = gig;
                tempGigModel.bands = GetBandsOnGig(gig);
                Location location = context.Locations.Where(l => l.LocationId == gig.Venue.LocationId).FirstOrDefault();
                tempGigModel.formattedAddress = GeoCode.FormatAddress(location);
                gigModels.Add(tempGigModel);
            }
            return(gigModels);
        }