Example #1
0
        //save film method that recieves a films object and updates the values
        //this is called in the controller in the edit film action
        public void SaveFilm(Films film)
        {
            Films dbEntry = _context.films
                            .FirstOrDefault(f => f.id == film.id);

            if (dbEntry != null)
            {
                dbEntry.category = film.category;
                dbEntry.title    = film.title;
                dbEntry.year     = film.year;
                dbEntry.director = film.director;
                dbEntry.rating   = film.rating;
                dbEntry.edited   = film.edited;
                dbEntry.lent     = film.lent;
                dbEntry.notes    = film.notes;
            }
            _context.SaveChanges();
        }
Example #2
0
 public static void AddFilm(Films film)
 {
     FilmsList.Add(film);
 }
Example #3
0
 //add film to be called in the controller when the user adds a new record
 public static void AddFilm(Films film)
 {
     films.Add(film);
 }