public ActionResult AddTalk(Models.Events.TalkModel model) { if (ModelState.IsValid) { Models.Events.Talk festivalEvent = new Models.Events.Talk { CartDescription = model.CartDescription, Interview = model.Interview, CartTitle = model.CartTitle, TicketPrice = model.TicketPrice, Location = eventRepository.GetLocation(model.Location.Id), StartDate = model.StartDate, EndDate = model.EndDate, Seats = model.Seats, ImagePath = model.ImagePath }; eventRepository.AddTalkEvent(festivalEvent); return(RedirectToAction("Talk")); } //return if invalid entry ViewBag.Locations = eventRepository.GetTalkLocations(); return(View(model)); }
public ActionResult EditTalk(Models.Events.Talk festivalEvent) { if (ModelState.IsValid) { eventRepository.UpdateTalkEvent(festivalEvent); TempData["message"] = String .Format("'{0}' on '{1}' has been saved successfully", festivalEvent.CartTitle, festivalEvent.StartDate .ToShortDateString()); return(RedirectToAction("Talk")); } ViewBag.Locations = eventRepository.GetTalkLocations(); return(View(festivalEvent)); }