diff --git a/LoggingClient/LoggingClient/LoggingClient.csproj b/LoggingClient/LoggingClient/LoggingClient.csproj index 1bd4952..8881a48 100644 --- a/LoggingClient/LoggingClient/LoggingClient.csproj +++ b/LoggingClient/LoggingClient/LoggingClient.csproj @@ -211,9 +211,7 @@ - - - + diff --git a/LoggingClient/LoggingClient/Repository/CustomerRepositoryEF.cs b/LoggingClient/LoggingClient/Repository/CustomerRepositoryEF.cs index e93e68d..83dc3fd 100644 --- a/LoggingClient/LoggingClient/Repository/CustomerRepositoryEF.cs +++ b/LoggingClient/LoggingClient/Repository/CustomerRepositoryEF.cs @@ -13,6 +13,8 @@ namespace LoggingClient.Repository } public List Customers { get; set; } + public string TableName => throw new NotImplementedException(); + public void Add(Customer newCustomerEntry) { using (var context = new inventarisierungsloesungEntities()) @@ -33,6 +35,16 @@ namespace LoggingClient.Repository } } + public long Count(string whereCondition, Dictionary parameterValues) + { + throw new NotImplementedException(); + } + + public long Count() + { + throw new NotImplementedException(); + } + public void Delete(Customer entity) { using (var context = new inventarisierungsloesungEntities()) diff --git a/LoggingClient/LoggingClient/Repository/CustomerRepositoryLinq.cs b/LoggingClient/LoggingClient/Repository/CustomerRepositoryLinq.cs index e24f2e8..f2b5cad 100644 --- a/LoggingClient/LoggingClient/Repository/CustomerRepositoryLinq.cs +++ b/LoggingClient/LoggingClient/Repository/CustomerRepositoryLinq.cs @@ -6,29 +6,30 @@ using System.Linq; namespace LoggingClient.Repository { - public class CustomerRepositoryLinq + public class CustomerRepositoryLinq : IRepositoryBase { - inventarisierungsloesungEntities _dataContext; - public CustomerRepositoryLinq() - { - _dataContext = new inventarisierungsloesungEntities(); - } + public CustomerRepositoryLinq() { } + + public string TableName => throw new NotImplementedException(); public void Add(Customer entity) { - var customer = new Customer() + using (var context = new inventarisierungsloesungEntities()) { - firstname = entity.firstname, - lastname = entity.lastname, - customernumber = entity.customernumber, - kundenkonto_fk = entity.kundenkonto_fk, - tel = entity.tel, - email = entity.email, - url = entity.url, - password = entity.password - }; - _dataContext.Customer.Add(customer); - _dataContext.SaveChanges(); + var customer = new Customer() + { + firstname = entity.firstname, + lastname = entity.lastname, + customernumber = entity.customernumber, + kundenkonto_fk = entity.kundenkonto_fk, + tel = entity.tel, + email = entity.email, + url = entity.url, + password = entity.password + }; + context.Customer.Add(customer); + context.SaveChanges(); + } } public void CallStoredProcedure(Customer entity) @@ -36,13 +37,26 @@ namespace LoggingClient.Repository throw new NotImplementedException(); } + public long Count(string whereCondition, Dictionary parameterValues) + { + throw new NotImplementedException(); + } + + public long Count() + { + throw new NotImplementedException(); + } + public void Delete(Customer entity) { - var x = (from c in _dataContext.Customer - where (c.customer_id == entity.customer_id) - select c).SingleOrDefault(); - _dataContext.Customer.Remove(x); - _dataContext.SaveChanges(); + using (var context = new inventarisierungsloesungEntities()) + { + var x = (from c in context.Customer + where (c.customer_id == entity.customer_id) + select c).SingleOrDefault(); + context.Customer.Remove(x); + context.SaveChanges(); + } } public List GetAll(string whereCondition, Dictionary parameterValues) @@ -52,7 +66,10 @@ namespace LoggingClient.Repository public IQueryable GetAll() { - return _dataContext.Customer.AsQueryable(); + using (var context = new inventarisierungsloesungEntities()) + { + return context.Customer.AsQueryable(); + } } public Customer GetSingle

(P pkValue) @@ -64,5 +81,10 @@ namespace LoggingClient.Repository { throw new NotImplementedException(); } + + List IRepositoryBase.GetAll() + { + throw new NotImplementedException(); + } } } diff --git a/LoggingClient/LoggingClient/Repository/LocationRepository.cs b/LoggingClient/LoggingClient/Repository/LocationRepository.cs index 7d153d1..55f1635 100644 --- a/LoggingClient/LoggingClient/Repository/LocationRepository.cs +++ b/LoggingClient/LoggingClient/Repository/LocationRepository.cs @@ -23,7 +23,6 @@ namespace LoggingClient.Repository { try { - location.AddressId = 2; using (var conn = new MySqlConnection(ConnectionString)) { conn.Open(); diff --git a/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs b/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs index faf4ba0..2f85bb2 100644 --- a/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs +++ b/LoggingClient/LoggingClient/ViewModel/CustomerViewModel.cs @@ -199,7 +199,7 @@ namespace LoggingClient.ViewModel try { var customerModelRepositoryEF = new CustomerRepositoryEF(); - customerModelRepositoryEF.Add(SelectedItem); + customerModelRepositoryEF.Add(MySelectedItem); Customers = customerModelRepositoryEF.GetAll(); } catch (Exception ex) diff --git a/dbTestat/ERM.pdf b/dbTestat/ERM.pdf old mode 100755 new mode 100644 diff --git a/dbTestat/inventarisierungsloesung.bak b/dbTestat/inventarisierungsloesung.bak old mode 100755 new mode 100644