public List <Order> GetAllOrders() { using (var context = new OrdersDBContext()) { return(context.Orders.Include(x => x.OrderStatus).ToList()); } }
public OrdersDBService() { using (var context = new OrdersDBContext()) { context.Database.EnsureCreated(); } }
public OrdersProvider(OrdersDBContext dbContext, ILogger <OrdersProvider> logger, IMapper mapper) { this.dbContext = dbContext; this.logger = logger; this.mapper = mapper; SeedData(); }
public Order GetOrderDetail(int orderId) { using (var context = new OrdersDBContext()) { Order detOrder = context.Orders.Include(o => o.OrderStatus).Include(o => o.ProductOrders) .ThenInclude(po => po.Product).FirstOrDefault(o => o.Id == orderId); return(detOrder); } }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new OrdersDBContext( serviceProvider.GetRequiredService <DbContextOptions <OrdersDBContext> >())) { // Look for any board games already in database. if (context.Orders.Any()) { return; // Database has been seeded } context.Orders.AddRange( new Order { Id = 1, Crust = "NORMAL", Flavor = "CHICKEN-FAJITA", Size = "L", TableNo = 3, }, new Order { Id = 2, Crust = "NORMAL", Flavor = "BEEF-NORMAL", Size = "M", TableNo = 5, }, new Order { Id = 3, Crust = "THIN", Flavor = "CHEESE", Size = "S", TableNo = 2, } ); context.SaveChanges(); } }
public async Task <IResult> ImportOrder() { IResult result = new Result(); using (OrdersDBContext db = new OrdersDBContext()) { using (var transaction = db.Database.BeginTransaction()) { try { string path = Path.Combine(_env.ContentRootPath, _settings.XmlFileName); string xmlInputData = string.Empty; string xmlOutputData = string.Empty; xmlInputData = await File.ReadAllTextAsync(path); XML.Orders item = Deserialize(xmlInputData); //save to db await SaveDataToDB(item); result.Success = true; transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); result.Message = $"{MessagesDictionary.GetErrorMessag("Error")} Exception: {ex.Message}"; } } } return(result); }
public OrdersRepository(OrdersDBContext dBContext) : base(dBContext) { }
public Repository(OrdersDBContext context) { Context_ = context; }
public BillingAddressesRepository(OrdersDBContext context) : base(context) { }
public OrderRepository(OrdersDBContext context) : base(context) { }
public PaymentsRepository(OrdersDBContext context) : base(context) { }
public PizzasController(OrdersDBContext context, ILogger <PizzasController> logger) { this._context = context; this._logger = logger; }
public ToppingsController(OrdersDBContext context, ILogger <ToppingsController> logger) { this._context = context; this._logger = logger; }
public OrdersRepository(OrdersDBContext ordersDBContext, ILogger <OrdersRepository> logger) { _ordersDBContext = ordersDBContext; _logger = logger; }
public GenericRepository(OrdersDBContext context) { _context = context; }
public OrdersController(OrdersDBContext context) { _context = context; }
public ArticlesRepository(OrdersDBContext context) : base(context) { }
public OrdersService(OrdersDBContext context) { this._context = context; }
public StatusesRepository(OrdersDBContext context) : base(context) { }
public OrderRepository(OrdersDBContext context) { _context = context; }
public AdressesRepository(OrdersDBContext context) : base(context) { }