public IHttpActionResult CreateMovie(ODataActionParameters parameters) { if (!ModelState.IsValid) { return BadRequest(ModelState); } string title = parameters["Title"] as string; Movie movie = new Movie() { Title = title, ID = _db.Movies.Count + 1, }; _db.Movies.Add(movie); return Created(movie); }
private bool TryCheckoutMovie(Movie movie) { if (movie.IsCheckedOut) { return false; } else { // To check out a movie, set the due date. movie.DueDate = DateTime.Now.AddDays(7); return true; } }