public ConsumerController(DatabaseInterface db) { _db = db; _product = new ProductStorage(db); _user = new CustomerStorage(db); _orders = new OrderAccess(db); }
public ActionResult <IEnumerable <string> > Get([FromQuery] string q) { var customers = new CustomerStorage(_config); if (q != null) { return(Ok(customers.GetByQuery(q))); } else { return(Ok(customers.GetAllCustomers())); } }
public void CreateCustomer_NameSpecified_CustomerWithNameIsCreated() { var context = new AlvTimeDbContextBuilder().CreateDbContext(); var storage = new CustomerStorage(context); var creator = new CustomerCreator(storage); var previousCustomersAmount = context.Customer.ToList().Count(); creator.CreateCustomer(new CustomerDto { Name = "Test" }); var newCustomersAmount = context.Customer.ToList().Count(); Assert.Equal(previousCustomersAmount + 1, newCustomersAmount); }
public ActionResult <string> GetById(int id, [FromQuery] string include) { var customer = new CustomerStorage(_config); if (include == "products") { return(Ok(customer.GetCustomerProducts(id, include))); } else if (include == "payments") { return(Ok(customer.GetCustomerPaymentTypes(id, include))); } else { return(Ok(customer.GetById(id))); } }
public void UpdateCustomer_ContactPersonProvided_UpdatesContactPerson() { var context = new AlvTimeDbContextBuilder() .WithCustomers() .CreateDbContext(); var storage = new CustomerStorage(context); var creator = new CustomerCreator(storage); creator.UpdateCustomer(new CustomerDto { Id = 1, InvoiceAddress = "Testveien 1" }); var customer = storage.GetCustomers(new CustomerQuerySearch { Id = 1 }).Single(); Assert.Equal("Testveien 1", customer.InvoiceAddress); }
/// <summary> /// Przepisanie danych wybranego zleceniodawcy do textBox'ów /// </summary> private void SetToTextbox() { CustomerStorage _customerStorage = new CustomerStorage(); foreach (var i in _customerStorage.Read()) { if (i.Name == _editOrder.Customer.Name) { comboBoxSelectCustomer.Items.Insert(0, i); comboBoxSelectCustomer.Text = i.Name; } else { comboBoxSelectCustomer.Items.Add(i); } } textBoxEditOrdername.Text = _editOrder.Name; textBoxEditComments.Text = _editOrder.Comments; textBoxEditOrderPrice.Text = string.Format("{0:0.00}", _editOrder.Price); dateEditOrderPicker.SelectedDate = _editOrder.Date; checkBoxIsPaid.IsChecked = _editOrder.IsPaid; }
public RegistrationForm(ProviderStorage logicP, CustomerStorage logicC) { InitializeComponent(); this.logicP = logicP; this.logicC = logicC; }
public CustomersController(IConfiguration config) { _storage = new CustomerStorage(config); }
public IActionResult GetCustomersWithNoOrders([FromQuery(Name = "Active")] bool active) { var customers = new CustomerStorage(_config); return(Ok(customers.GetCustomersWithNoOrders(active))); }
public void AddCustomer(Customers customer) { var customerz = new CustomerStorage(_config); customerz.Add(customer); }
public IActionResult DeactivateCustomer(int id) { var customers = new CustomerStorage(_config); return(Ok(customers.DeactivateCustomer(id))); }
public IActionResult UpdateCustomer(int id, Customers customer) { var customers = new CustomerStorage(_config); return(Ok(customers.UpdateCustomer(id, customer))); }
public CustomersController(DatabaseInterface db) { _db = db; _customers = new CustomerStorage(db); }