Exemplo n.º 1
0
 protected void SeedDb()
 {
     using (var context = new MMTContext(dbContextOptions))
     {
         if (!context.Category.Any())
         {
             context.Category.AddRange(FakeCategories());
         }
         if (!context.Product.Any())
         {
             context.Product.AddRange(FakeProducts());
         }
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Commit database changes
 /// </summary>
 /// <returns></returns>
 public int SaveChanges()
 {
     return(context.SaveChanges());
 }
Exemplo n.º 3
0
        public CommandResponse Commit()
        {
            var rowsAffected = _context.SaveChanges();

            return(new CommandResponse(rowsAffected > 0));
        }