Example #1
0
        public Sale Save(Sale sale)
        {
            context.Sales.Add(sale);
            context.SaveChanges();

            return(sale);
        }
Example #2
0
        public static void Initialize(CheckoutDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.AuthenticationTokens.Any())
            {
                return;   // DB has been seeded
            }

            var auth = new AuthenticationToken()
            {
                AccessToken  = "lkafjldskjfdsl",
                CustomerKey  = "dlskfldjf",
                Name         = "teste",
                RefreshToken = "aldkj",
                TokenType    = "Tester",
                UserId       = Guid.NewGuid(),
                Username     = "******"
            };

            context.AuthenticationTokens.Add(auth);

            context.SaveChanges();
        }
 public virtual void Remove(params T[] items)
 {
     try {
         using (var context = new CheckoutDbContext())
         {
             foreach (T item in items)
             {
                 context.Entry(item).State = EntityState.Deleted;
             }
             context.SaveChanges();
         }
     }
     catch (DbEntityValidationException ex)
     {
         Log(FleshExeptionOut(ex));
         throw;
     }
 }
Example #4
0
 public void Save(AuthenticationToken authenticationToken)
 {
     context.AuthenticationTokens.Add(authenticationToken);
     context.SaveChanges();
 }