//[ValidateAntiForgeryToken] public ActionResult Create(Models.Show model) { if (ModelState.IsValid) { if (!(showService.ExistsShow(model.CinemaCity) && showService.ExistsShow(model.FilmName) && showService.ExistsShow(model.ShowTimeFilm))) { var dbModel = new Domain.Show(); dbModel.InjectFrom(model); showService.AddShow(dbModel); TempData["message"] = string.Format("{0} has been saved", model.FilmName); } else { ModelState.AddModelError("Show", "Cannot have two identical shows!"); //Cinema var cinemas = cinemaRepository.GetAll(); var cinemaList = cinemas.Select(c => new SelectListItem() { Value = c.Id.ToString(), Text = c.CinemaCity }).ToList(); //Film var films = filmRepository.GetAll(); var filmList = films.Select(f => new SelectListItem() { Value = f.Id.ToString(), Text = f.Name }).ToList(); //ShowTimeFilm var showtimefilms = showtimefilmRepository.GetAll(); var showtimefilmList = showtimefilms.Select(s => new SelectListItem() { Value = s.Id.ToString(), Text = s.ShowTime.ToString("dd/MM/yyyy hh:mm") }).ToList(); ViewBag.Cinemas = cinemaList; ViewBag.Films = filmList; ViewBag.ShowTimeFilms = showtimefilmList; return(View(model)); } //showRepository.Add(dbModel); //transform the object //unitOfWork.Commit(); return(RedirectToAction("Index")); } return(View(model)); }