public ActorsController(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 2
0
 public FilmTextController(sakilaContext context)
 {
     _context = context;
 }
 public ActorsController(sakilaContext context)
 {
     actors = new ActorsRepository(context);
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            //List actors names and lastnames:

            var dbContext = new sakilaContext();
            var actors    = dbContext.Actor.ToList();

            foreach (var a in actors)
            {
                System.Console.WriteLine($"ID:{a.ActorId} Name:{a.FirstName} {a.LastName}");
            }



            //List films and their actors:

            // var dbContext = new sakilaContext();
            // var records = dbContext.Film.Include(f => f.FilmActor).ThenInclude(r => r.Actor).ToList();
            // foreach (var record in records)
            // {
            //     System.Console.WriteLine($"Film: {record.Title}");
            //     var counter = 1;
            //     foreach (var fa in record.FilmActor)
            //     {
            //         System.Console.WriteLine($"\tActor {counter++}: {fa.Actor.FirstName} {fa.Actor.LastName}");
            //     }
            // }



            //CREATE NEW VALUE ON db:

            // var dbContext = new sakilaContext();
            // var city = new City() { CityId = 1001, Name = "Gdansk", CountryId = 103 };
            // dbContext.Add(city);
            // dbContext.SaveChanges();



            //Update record od the DB:

            // var dbContext = new sakilaContext();
            // var uTarget = dbContext.City.SingleOrDefault(c => c.CityId == 1001);
            // if (uTarget != null)
            // {
            //     uTarget.Name = "Sopot";  // change Name to City1 if you did not update the City class file
            //     dbContext.Update(uTarget);
            //     dbContext.SaveChanges();
            // }



            //Delete record from DB:

            // var dbContext = new sakilaContext();
            // var dTarget = dbContext.City.SingleOrDefault(c => c.CityId == 1001);
            // if (dTarget != null)
            // {
            //     dbContext.Remove(dTarget);
            //     dbContext.SaveChanges();
            // }
        }
 public ValuesController(sakilaContext dbContext, MappedSchemaProvider <sakilaContext> schemaProvider)
 {
     this._dbContext      = dbContext;
     this._schemaProvider = schemaProvider;
 }
Esempio n. 6
0
 public AddressesController(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 7
0
 public CourseController(sakilaContext context)
 {
     courses = new CoursesRepository(context);
 }
Esempio n. 8
0
 public RecordsController(sakilaContext context)
 {
     records = new RecordsRepository(context);
 }
Esempio n. 9
0
 public ActorRepository(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 10
0
 public CustomersController(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 11
0
 public TaskController(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 12
0
 public RentalsController(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 13
0
 public StoreService(sakilaContext context)
 {
     _context = context;
 }
 public MovieRepository(sakilaContext context)
 {
     _context = context;
 }
Esempio n. 15
0
 public GradesController(sakilaContext context)
 {
     records  = new RecordsRepository(context);
     students = new StudentRepository(context);
     courses  = new CoursesRepository(context);
 }