コード例 #1
0
        public ActionResult AddHear(Models.Events.JazzModel model)
        {
            if (ModelState.IsValid)
            {
                Models.Events.Jazz festivalEvent = new Models.Events.Jazz
                {
                    CartDescription = model.CartDescription,
                    CartTitle       = model.CartTitle,
                    Band            = model.Band,
                    imagePath       = model.imagePath,
                    TicketPrice     = model.TicketPrice,
                    Location        = eventRepository.GetLocation(model.Location.Id),
                    StartDate       = model.StartDate,
                    EndDate         = model.EndDate,
                    Seats           = model.Seats
                };
                eventRepository.AddHearEvent(festivalEvent);

                return(RedirectToAction("Hear"));
            }

            //return if invalid entry
            ViewBag.Locations = eventRepository.GetHearLocations();
            return(View(model));
        }