/// <summary> /// Constructor /// </summary> /// <param name="customers"></param> /// <param name="context"></param> public OrderService( ICustomerService customers, TinyCrmDbContext context) { context_ = context; customers_ = customers; }
public ProductController( TinyCrmDbContext context, IProductService products) { context_ = context; products_ = products; }
public OrderServiceTests(TinyCrmFixture fixture) { context_ = fixture.DbContext; customers_ = fixture.Container.Resolve <ICustomerService>(); orders_ = fixture.Container.Resolve <IOrderService>(); products_ = fixture.Container.Resolve <IProductService>(); }
public IActionResult Privacy() { using (var context = new TinyCrmDbContext()) { var customerService = new CustomerService(context); } return(View()); }
public void Orders_Retrieve() { using (var context = new TinyCrmDbContext()) { var orders = context .Set <Order>() .Include(o => o.Customer) .ToList(); } }
public OrderService( TinyCrmDbContext context, ICustomerService customer, IProductService product) { context_ = context; customers_ = customer; products_ = product; }
public OrderService( TinyCrmDbContext context, ICustomerService custService, IProductService prodService) { context_ = context; customerService = custService; productService = prodService; }
public OrderService( TinyCrmDbContext context, ICustomerService customers, IProductService products) { context_ = context; customer_ = customers; product_ = products; }
public void Customer_Order_Retrieve() { using (var context = new TinyCrmDbContext()) { var customer = context .Set <Customer>() .Where(c => c.VatNumber == "117003949") .FirstOrDefault(); Assert.NotNull(customer); } }
public ReportService( TinyCrmDbContext context, ICustomerService customer, IProductService product, IOrderService order) { context_ = context; customer_ = customer; product_ = product; order_ = order; }
public void RetrieveContacts() { var customerId = AddCustomerContacts(); using (var context = new TinyCrmDbContext()) { var contacts = context .Set <Customer>() .Include(c => c.Contacts) // fernei sigkekrimena antikeimena apo tin vasi .Where(c => c.Id == customerId) .Select(c => c.Contacts) .ToList(); } }
static void Main(string[] args) { using (var context = new TinyCrmDbContext()) { ICustomerService customerService = new CustomerService(context); IProductService productService = new ProductService(context); //context.Add( //new Product //{ // Name = "iPhone", // Price = 1000, // InStock = 100, // Id = "123", // Category = ProductCategory.Smartphones //}); //context.Add( // new Product // { // Name = "Nikon", // Price = 599, // InStock = 74, // Id = "345", // Category = ProductCategory.Cameras // }); //context.SaveChanges(); //var sum = productService.SumOfStocks(); //var options = new SearchCustomerOptions //{ // VatNumber = 123456789 //}; var customer = new Customer() { }; context.Set <Customer>().Add(customer); context.SaveChanges(); //return customer; //var results = customerService.Create(Customer); //var options = new SearchCustomerOptions //{ // FirstName = "itr" //}; } }
public IActionResult Privacy() { using (var context = new TinyCrmDbContext()) { var customerService = new CustomerService(context); var customer = customerService.SearchCustomers( new SearchCustomerOptions() { CustomerId = 1 }).SingleOrDefault(); return(Json(customer)); } }
public void Customer_Order_Success() { using (var context = new TinyCrmDbContext()) { var customer = new Customer() { VatNumber = "117003949", Email = "*****@*****.**", }; customer.Orders.Add( new Order() { DeliveryAddress = "Kleemann Kilkis" }); context.Add(customer); context.SaveChanges(); } }
static void Main(string[] args) { using (var context = new TinyCrmDbContext()) { var customerService = new CustomerService(context); var newCustomer = customerService.CreateCustomer(new CustomerOptions() { FirstName = "Avraam", LastName = "Liaoutsis", VatNumber = "1313-asdASD=123", IsActive = true }); //var newProduct = productService.Create(new // ProductOptions() //{ // Name = "Mac os", // Category = ProductCategory.Laptops, // Price = 500, // ProductId = "ASDASD1-242" //} //); //var productsToBuy = new List<Product>(); //var productsIdsToBuy = new List<string>(); //productsToBuy.Add(newProduct); //productsIdsToBuy.Add(newProduct.ProductId); //var newOrder = orderService.CreateOrder(new OrderOptions() //{ // CustomerId = newCustomer.Id, // ProductIds = productsIdsToBuy //}); //Console.WriteLine(newOrder); context.Dispose(); } }
public int AddCustomerContacts() { using (var context = new TinyCrmDbContext()) { var customer = new Customer() { Firstname = "George", Lastname = "Stathis", Email = "*****@*****.**" }; var Contacts = new ContactPerson() { Email = "*****@*****.**" }; customer.Contacts.Add(Contacts); context.Add(customer); context.SaveChanges(); return(customer.Id); } }
static void Main(string[] args) { using (var context = new TinyCrmDbContext()) { ICustomerService customerService = new CustomerService( context); IProductService productService = new ProductService( context); IOrderService orderService = new OrderService( context, custService, prodService); var customer = customerService.CreateCustomer( new CreateCustomerOptions() { FirstName = "Dimitris", LastName = "Pnevmatikos", VatNumber = "123456789" }); } }
public ProductService(TinyCrmDbContext context) { context_ = context; }
public CustomerService(TinyCrmDbContext context) { context_ = context; }
static void Main(string[] args) { //Log.Logger = new LoggerConfiguration() // .WriteTo.Console() // .WriteTo.File($@"{System.IO.Directory.GetCurrentDirectory()}\logs\{DateTime.Now:yyyy-MM-dd}\log-.txt", // rollingInterval: RollingInterval.Day) // .CreateLogger(); //Log.Error("this is an error"); //Console.ReadKey(); var context = new TinyCrmDbContext(); // Console.WriteLine(context.Database.CanConnect()); context.Database.EnsureCreated(); //var p = new Product() //{ // Id = "3455", // ProductCategory = ProductCategory.Computers, // Price = 99.99M, // Discount = 0 //}; //var c1 = new Customer() //{ // Email = "*****@*****.**", // Firstname = "kostas", // Lastname = "papadopoulos", // Phone = "698965663 ", // VatNumber = " RDJ234", // Created = DateTimeOffset.Now //}; //context.Add(c1); //context.SaveChanges(); //context.Remove(c1); //context.SaveChanges(); //var y= context.Set<Customer>() //anazitisi // .Where(o => o.Id == 4) // .ToList(); //vazoume .tolist giati to antikeimeno pou epstrefei den einai kanoniko antikeimno // context.Remove(y[0]); // context.SaveChanges(); //var q = context.Set<Customer>() // .Where(o => o.Id == 2); //var customer = q.SingleOrDefault(); var productService = new ProductService(context); productService.AddProduct( new AddProductOptions() { Id = "12345", Price = 153.33M, ProductCategory = ProductCategory.Cameras, Name = "Camera 1" }); productService.AddProduct( new AddProductOptions() { Id = "4556", Price = 613.33M, ProductCategory = ProductCategory.Cameras, Name = "camera 2" }); productService.UpdateProduct("123", new UpdatedProductOptions() { Price = 22.22M }); Console.WriteLine(productService.GetProductById("12345")); string path = @"C:/Users/KCA9/Downloads/kl-oop-master/kl-oop-master/products.csv"; productService.readFile(path); }
public OrderService(TinyCrmDbContext context, ICustomerService customerService) { context_ = context; customerService_ = customerService; }
public CustomerServiceTests() { context_ = new TinyCrmDbContext(); }
public OrderService(TinyCrmDbContext context, ICustomerService customerService, IProductService productService) { _context = context; _customerService = customerService; _productService = productService; }
public ProductService(TinyCrmDbContext ctx) //na tin perasw pantoy { context = ctx ?? throw new ArgumentNullException(nameof(ctx)); }
public HomeController() { context = new TinyCrmDbContext(); customerService_ = new CustomerService( context); }
public CustomerController() { _dbContext = new TinyCrmDbContext(); _customerService = new CustomerService(_dbContext); }
public CustomerController() { dbContext_ = new TinyCrmDbContext(); customerService_ = new CustomerService(dbContext_); }
public ProductService(TinyCrmDbContext ctx) { context = ctx ?? throw new ArgumentNullException(nameof(ctx)); }
public ProductService(TinyCrmDbContext dbContext) { context = dbContext; }
public OrderService(ICustomerService cService, TinyCrmDbContext context) { dbContext = context; customerService = cService; productService = new ProductService(dbContext); }