Example #1
0
        public ActionResult AddMovie(Movie movie, string imdbId)
        {
            movie.Id = imdbId;
            movie.imdbRating = movie.imdbRating / 10; //Ful lösning

            using (var db = new DBModel())
            {
                if (db.Movies.Any(m => m.Id == movie.Id))
                {
                    return Json(new { success = false, message = movie.Title + " is already in the database." });
                }
                db.Movies.Add(movie);
                db.SaveChanges();
            }
            return Json(new { success = true, message = movie.Title + " was added to the database." });
        }
Example #2
0
 public static Clue[] GetCluesForMovie(Movie movie)
 {
     //Fult sätt att göra det på. Lateeers.
     var splitActors = movie.Actors.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
     var clues = new Clue[]
     {
         new Clue("", 3, "year", movie.Year.ToString()),
         new Clue("Genre", 5, "genre", movie.Genre),
         new Clue("Actor #4", 7, "actor4", splitActors[3].Trim()),
         new Clue("Actor #3", 7, "actor3", splitActors[2].Trim()),
         new Clue("Actor #2", 8, "actor2", splitActors[1].Trim()),
         new Clue("Lead actor", 8, "actor1", splitActors[0].Trim()),
         new Clue("Director", 8, "director", movie.Director),
         new Clue("Plot", 11, "plot", movie.Plot),
         new Clue("Game over", 6, "title", movie.Title),
         //new Clue("Next round starting", 0, "", ""), //TA BORT! Sluta en tidigare, gå till endround
     };
     //foreach (Clue c in clues) //FÖR DEBUGGING ENDAST
     //    c.SecondsToShow = 2;
     return clues;
 }