public ActionResult AddTaste(Models.Events.DinerModel model) { if (ModelState.IsValid) { Models.Events.Diner festivalEvent = new Models.Events.Diner { CartDescription = model.CartDescription, CartTitle = model.CartTitle, TicketPrice = model.TicketPrice, ReducedPrice = model.ReducedPrice, RestaurantId = model.RestaurantId, Restaurant = eventRepository.GetRestaurant(model.RestaurantId), StartDate = model.StartDate, EndDate = model.EndDate, Seats = model.Seats }; eventRepository.AddTasteEvent(festivalEvent); return(RedirectToAction("Taste")); } //return if invalid entry ViewBag.Locations = eventRepository.GetTasteLocations(); return(View(model)); }
public ActionResult EditTaste(Models.Events.Diner festivalEvent) { if (ModelState.IsValid) { festivalEvent.Restaurant = eventRepository.GetRestaurant(festivalEvent.RestaurantId); eventRepository.UpdateTasteEvent(festivalEvent); TempData["message"] = String .Format("'{0}' on '{1}' has been saved successfully", festivalEvent.CartTitle, festivalEvent.StartDate .ToShortDateString()); return(RedirectToAction("Taste")); } ViewBag.Locations = eventRepository.GetTasteLocations(); return(View(festivalEvent)); }