private void InitializeDatabase() { using (var context = new OrderManagementContext()) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var emma = new Customer { Id = 1, FirstName = "Emma", LastName = "Johnson" }; var marc = new Customer { Id = 2, FirstName = "Marc", LastName = "Milston" }; var camera = new Order { Id = 1, Description = "Camera", DeliveryAddress = "Address 1", Price = 550 }; var wallet = new Order { Id = 2, Description = "Wallet", DeliveryAddress = "Address 2", Price = 10 }; var customerRepository = new CustomerRepository(context); customerRepository.Add(emma); customerRepository.Add(marc); customerRepository.SaveChanges(); var orderRepository = new OrderRepository(context); orderRepository.Add(camera); orderRepository.Add(wallet); orderRepository.SaveChanges(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (txt_username.Text.Length == 0) { MessageBox.Show("Please Enter Valid UserName"); } else if (txt_password.Password.Length == 0) { MessageBox.Show("Please Enter Valid Password"); } else if (txt_username.Text.Length != 0 && txt_password.Password.Length != 0) { string username = txt_username.Text; string password = txt_password.Password.ToString(); OrderManagementContext orderManagementContext = new OrderManagementContext(); var userFound = orderManagementContext.UserMaster.Where(s => s.Email == username & s.Password == password).FirstOrDefault(); if (userFound != null) { Menu menu = new Menu(); menu.Show(); } else { MessageBox.Show(" Enter Valid UserCredentials"); } } }
public IEnumerable <Customer> Get() { using (var context = new OrderManagementContext()) { return(context.Customers.ToArray()); } }
public async Task <IEnumerable <Customer> > Get() { using (var context = new OrderManagementContext()) { return(await context.Customers.ToArrayAsync()); } }
public Customer Get(Guid id) { using (var context = new OrderManagementContext()) { return(context.Customers .SingleOrDefault(c => c.CustomerId == id)); } }
public async Task <Customer> Get(Guid id) { using (var context = new OrderManagementContext()) { return(await context.Customers .SingleOrDefaultAsync(c => c.CustomerId == id)); } }
public IEnumerable <Customer> Get(string countryIsoCode) { using (var context = new OrderManagementContext()) { return(context.Customers .Where(c => c.CountryIsoCode == countryIsoCode) .ToArray()); } }
public async Task <IEnumerable <Customer> > Get(string countryIsoCode) { using (var context = new OrderManagementContext()) { return(await context.Customers .Where(c => c.CountryIsoCode == countryIsoCode) .ToArrayAsync()); } }
public void test() { OrderManagementContext context = new OrderManagementContext(); IEnumerable <OM_DepartmentDto> test1 = context.Set <OM_Permission>().Where(p => p.ID > 0).Select(p => Mapper.Map <OM_Permission, OM_DepartmentDto>(p)); OM_Permission permission = new OM_Permission(); OM_DepartmentDto test = Mapper.Map <OM_Permission, OM_DepartmentDto>(permission); }
public static OrderManagementContext GetOrderManageContext() { if (orderMgmtContext == null) { var ordersAgent = new OrderSiteAgent(GetSiteName()); orderMgmtContext = OrderManagementContext.Create(ordersAgent); } return(orderMgmtContext); }
private void ConfigureDependencies() { _context = new OrderManagementContext(); _customerRepository = new CustomerRepository(_context); _orderRepository = new OrderRepository(_context); _unitOfWork = new UnitOfWork(_context); _customerController = new CustomerController(_customerRepository); _orderController = new OrderController(_orderRepository, _unitOfWork); }
private static void LoadOrderContext() { if (orderContext == null) { var siteName = Configuration.CSSiteName; ordersAgent = new OrderSiteAgent(siteName); context = OrderManagementContext.Create(ordersAgent); manager = context.PurchaseOrderManager; orderContext = CommerceServer.Core.Runtime.Orders.OrderContext.Create(siteName); } }
static void Main(string[] args) { Console.WriteLine("Press any key to continue with clearing the database 'ODataFaq' on (localdb)\\v11.0 and filling it with demo data ..."); Console.ReadKey(); Console.WriteLine("Please be patient, generating data ..."); using (var omc = new OrderManagementContext()) { omc.ClearAndFillWithDemoData().Wait(); } Console.WriteLine("Done. Press any key to quit ..."); Console.ReadKey(); }
public OrderManagementConsumer(ILogger logger, OrderManagementContext context, IShipmentService shipmentService, IProductAttributeService productAttributeService, IRepository <ProductAttributeCombination> productAttributeCombinationRepository, IProductService productService, IManufacturerService manufacturerService) { this._logger = logger; this._context = context; this._shipmentService = shipmentService; this._productAttributeService = productAttributeService; this._productAttributeCombinationRepository = productAttributeCombinationRepository; this._productService = productService; this._manufacturerService = manufacturerService; }
public async Task TestAddCustomers() { var optionsBuilder = new DbContextOptionsBuilder <OrderManagementContext>(); optionsBuilder.UseInMemoryDatabase("DB"); using (var context = new OrderManagementContext(optionsBuilder.Options)) { var controller = new CustomersController(context); await controller.PostCustomer(new Customer { CompanyName = "Foo Bar", CountryIsoCode = "AT" }); Assert.NotEmpty(context.Customers); } }
public OrderManagementService(IRepository <Order> aoOrderRepository, OrderManagementContext context, ILogger logger, IProductAttributeService productAttributeService, IWorkContext workContext, IShipmentService shipmentService, IOrderService orderService, IWorkflowMessageService workflowMessageService, IRepository <ProductAttributeCombination> productAttributeCombinationRepository) { this._logger = logger; this._aoOrderRepository = aoOrderRepository; this._context = context; this._productAttributeService = productAttributeService; this._workContext = workContext; this._workikngCultureInfo = new CultureInfo(_workContext.WorkingLanguage.UniqueSeoCode); this._shipmentService = shipmentService; this._orderService = orderService; this._workflowMessageService = workflowMessageService; this._productAttributeCombinationRepository = productAttributeCombinationRepository; }
public override void Execute() { InitializeDatabase(); using var context = new OrderManagementContext(); var customerRepository = new CustomerRepository(context); var orderRepository = new OrderRepository(context); var customerController = new CustomerController(customerRepository); var orderController = new OrderController(orderRepository); ShowAllCustomers(); ShowAllOrders(); CreateNewOrder(); ShowAllOrders(); void ShowAllCustomers() { Console.WriteLine("Showing all customers..."); foreach (var customer in customerController.GetAll()) { Console.WriteLine($"{customer.FirstName} {customer.LastName}"); } } void ShowAllOrders() { Console.WriteLine("\nShowing all orders..."); foreach (var order in orderController.GetAll()) { Console.WriteLine($"{order.Description} with price of {order.Price:C}"); } } void CreateNewOrder() { Console.WriteLine("\nCreating new order..."); orderController.Create(3, "PlayStation 5", "Address 3", 600); } }
public CategoryRepository(OrderManagementContext context) { _context = context; }
public OrdersRepository(OrderManagementContext ctx, ILogger <OrdersRepository> logger) { _ctx = ctx; _logger = logger; }
public ProductsController(ILogger <UsersController> logger, OrderManagementContext context, IHostingEnvironment hostingEnvironment) { _logger = logger; _context = context; _hostingEnvironment = hostingEnvironment; }
public CustomerRepository(OrderManagementContext context) : base(context) { }
public CartRepository(IOptions <ConnectionStrings> connectionStrings) { _connectionStrings = connectionStrings; _orderManagementContext = new OrderManagementContext(_connectionStrings.Value.DatabaseConnectionString); }
public ItemMastersController() { _context = new OrderManagementContext(); }
public CustomersController(OrderManagementContext context) { _context = context; }
public PaymentDbAccess(OrderManagementContext context) { _context = context; }
public AccountsController(ILogger <AccountsController> logger, OrderManagementContext context) { _logger = logger; _context = context; }
public AddToCartDbAccess(OrderManagementContext context) { _context = context; }
public OrderDetailsController() { _context = new OrderManagementContext(); }
public FillDatabaseController(OrderManagementContext context) { db = context; }
public PlaceOrderDbAccess(OrderManagementContext context) { _context = context; }