public ActionResult Create(Movie movie) { if (ModelState.IsValid) { _moviesRepository.Create(movie); return RedirectToAction("Index"); } return View(movie); }
/// <summary> /// Adds the Movie specified in the argument to the database. /// Returns true iff successful. /// </summary> /// <param name="movieid"></param> /// <returns></returns> public async Task <bool> AddMovie(string movieid) { if (MovieExists(movieid)) { Console.WriteLine("RepoLogic.AddMovie() was called for a movie that doesn't exist."); return(false); } Repository.Models.Movie movie = new Repository.Models.Movie(); movie.MovieId = movieid; await _dbContext.Movies.AddAsync(movie); await _dbContext.SaveChangesAsync(); return(true); }