Ejemplo n.º 1
0
        public async Task Delete(string id)
        {
            var studentModel = await _context.Set <T>().FindAsync(id);

            _context.Set <T>().Remove(studentModel);
            await _context.SaveChangesAsync();
        }
        public static Task Seed(this AppContext context)
        {
            context.Bankers.Add(new Banker
            {
                Id   = "Banker1",
                Name = "Hakan Tuncer"
            });

            context.Clients.Add(new Client
            {
                Id = "Client1",
                RelatedBankerId = "Banker1",
                Name            = "James Bond",
                Address         = "Dam Square 123, Amsterdam",
                NetWorth        = 27340677
            });

            return(context.SaveChangesAsync());
        }
Ejemplo n.º 3
0
 public async Task CommitAsync()
 {
     _dbContext.ChangeTracker.DetectChanges();
     await _dbContext.SaveChangesAsync();
 }
Ejemplo n.º 4
0
 public async Task Create(StudentModel studentModel)
 {
     _context.Add(studentModel);
     await _context.SaveChangesAsync();
 }