Пример #1
0
        public ActionResult Create(CreateFilmViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            try
            {
                FilmService.CreateFilm(viewModel);
            }
            catch
            {
                throw;
            }

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult Create(FilmCreate model)
        {
            model.MediaType = MediaType.Film;

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new FilmService();

            if (service.CreateFilm(model))
            {
                TempData["SaveResult"] = "The film was created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "The film could not be created.");

            return(View(model));
        }