Exemple #1
0
 public List <Order> GetAllOrders()
 {
     using (var context = new OrdersDBContext())
     {
         return(context.Orders.Include(x => x.OrderStatus).ToList());
     }
 }
Exemple #2
0
 public OrdersDBService()
 {
     using (var context = new OrdersDBContext())
     {
         context.Database.EnsureCreated();
     }
 }
Exemple #3
0
        public OrdersProvider(OrdersDBContext dbContext, ILogger <OrdersProvider> logger, IMapper mapper)
        {
            this.dbContext = dbContext;
            this.logger    = logger;
            this.mapper    = mapper;

            SeedData();
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        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();
            }
        }
Exemple #6
0
        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)
 {
 }
Exemple #8
0
 public Repository(OrdersDBContext context)
 {
     Context_ = context;
 }
 public BillingAddressesRepository(OrdersDBContext context) : base(context)
 {
 }
 public OrderRepository(OrdersDBContext context) : base(context)
 {
 }
Exemple #11
0
 public PaymentsRepository(OrdersDBContext context) : base(context)
 {
 }
Exemple #12
0
 public PizzasController(OrdersDBContext context, ILogger <PizzasController> logger)
 {
     this._context = context;
     this._logger  = logger;
 }
Exemple #13
0
 public ToppingsController(OrdersDBContext context, ILogger <ToppingsController> logger)
 {
     this._context = context;
     this._logger  = logger;
 }
Exemple #14
0
 public OrdersRepository(OrdersDBContext ordersDBContext, ILogger <OrdersRepository> logger)
 {
     _ordersDBContext = ordersDBContext;
     _logger          = logger;
 }
 public GenericRepository(OrdersDBContext context)
 {
     _context = context;
 }
Exemple #16
0
 public OrdersController(OrdersDBContext context)
 {
     _context = context;
 }
 public ArticlesRepository(OrdersDBContext context) : base(context)
 {
 }
Exemple #18
0
 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)
 {
 }