예제 #1
0
        public List <FilmGenres> GetFilmGenres(string cs, int FilmID)
        {
            using var con = new MySqlConnection(cs);
            con.Open();

            using (MySqlCommand cmd = new MySqlCommand())
            {
                cmd.Connection  = con;
                cmd.CommandText = "spGetFilmGenres";           // The name of the Stored Proc
                cmd.CommandType = CommandType.StoredProcedure; // It is a Stored Proc

                cmd.Parameters.AddWithValue("@FilmID", FilmID);
                IList <FilmGenres> wsl = new List <FilmGenres>();
                var reader             = cmd.ExecuteReader();
                while (reader.Read())
                {
                    var ws = new FilmGenres();
                    ws.FilmGenreID = reader.GetInt32("FilmGenreID");
                    ws.GenreText   = reader.GetString("GenreText");

                    wsl.Add(ws);
                }
                reader.Close();
                return((List <FilmGenres>)wsl);
            }
        }
예제 #2
0
        public async Task <ActionResult <FilmGenres> > PostFilmGenres(FilmGenres filmGenres)
        {
            _context.FilmGenres.Add(filmGenres);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFilmGenres", new { id = filmGenres.Id }, filmGenres));
        }
예제 #3
0
        public async Task <IActionResult> PutFilmGenres(int id, FilmGenres filmGenres)
        {
            if (id != filmGenres.Id)
            {
                return(BadRequest());
            }

            _context.Entry(filmGenres).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FilmGenresExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #4
0
        private void GenerateFilmGenres()
        {
            FilmGenres.Add(new FilmGenre
            {
                FilmGenreId = Guid.Parse("9935A7B6-BA86-4B5D-B771-3170BA906613"),
                MediaId     = Guid.Parse("3B14C9FF-E104-4847-B243-F1ADE305363C"),
                DetailId    = Guid.Parse("D9787903-38C0-4DBB-95C6-99A396DA0090")
            });

            FilmGenres.Add(new FilmGenre
            {
                FilmGenreId = Guid.Parse("52F815ED-55D5-4808-B0BC-6DAABFF745B8"),
                MediaId     = Guid.Parse("3B14C9FF-E104-4847-B243-F1ADE305363C"),
                DetailId    = Guid.Parse("FEFF914A-149B-4C44-9688-7B287F650AA1")
            });
        }
예제 #5
0
    // Constructor for Script classes (only required for creating class in code)
    public Script(string title, string genre,
                  float plot, float character, float action, float violenceAndGore,
                  float effects, float romance, float jokes, float scares,
                  float satire, float raunch,
                  int castNumber, int locationNumber)
    {
        this.title = title;

        this.plot            = plot;
        this.character       = character;
        this.action          = action;
        this.violenceAndGore = violenceAndGore;
        this.effects         = effects;
        this.romance         = romance;
        this.jokes           = jokes;
        this.scares          = scares;
        this.satire          = satire;
        this.raunchiness     = raunch;

        this.numberOfCast      = castNumber;
        this.numberOfLocations = locationNumber;

        switch (genre)
        {
        case "action":
            this.selectedGenre = FilmGenres.Action;
            break;

        case "comedy":
            this.selectedGenre = FilmGenres.Comedy;
            break;

        case "drama":
            this.selectedGenre = FilmGenres.Drama;
            break;

        case "family":
            this.selectedGenre = FilmGenres.Family;
            break;

        case "mystery":
            this.selectedGenre = FilmGenres.Mystery;
            break;

        case "horror":
            this.selectedGenre = FilmGenres.Horror;
            break;

        case "romance":
            this.selectedGenre = FilmGenres.Romance;
            break;

        case "scififant":
            this.selectedGenre = FilmGenres.SciFiFantasy;
            break;

        default:
            Debug.Log("ERROR: Genre input '" + genre + "' is not valid.\n" +
                      "Valid strings:\n" +
                      "action\ncomedy\ndrama\nfamily\nmystery\nhorror\nromance\nscififant");
            break;
        }

        scriptCount++;
        this.scriptID = scriptCount;
    }