public void DeleteSeller(Seller seller) { using (var ctx = new SystemContext()) { ctx.Sellers.Attach(seller); ctx.Sellers.Remove(seller); ctx.SaveChanges(); } }
public List<Property> GetAllProperties(Seller seller) { List<Property> properties; using (var ctx = new SystemContext()) { properties = ctx.Properties.Where(x => x.SellerID == seller.Id).ToList(); } return properties; }
public void CreateTest() { //Create necessary list for seller. List<Property> propertyList = new List<Property>(); //Create the seller itself. Seller sellDatHouse = new Seller() { Name = "Mr. Sell D. House", Address = "Sofiendalsvej 60", Email = "*****@*****.**", Misc = "Han vil virkelig gerne have sit hus solgt", Mobile = "40528283", Phone = "40528283", ZipCode = "9000", Properties = propertyList }; //Save it to the database int CountDB = sCtr.GetAllSellers().ToList().Count; sCtr.InsertSeller(sellDatHouse); int CountDBAfter = sCtr.GetAllSellers().ToList().Count; //Compare sellers. Assert.AreEqual<int>(CountDBAfter, CountDB + 1); sCtr.DeleteSeller(sellDatHouse); }
public void InsertAppointment(Appointment appointment, Buyer buyer, Seller seller) { using (var ctx = new SystemContext()) { ctx.Appointments.Add(appointment); if (buyer != null) { ctx.Buyers.Attach(buyer); appointment.Buyer = buyer; } if (seller != null) { ctx.Sellers.Attach(seller); appointment.Seller = seller; } ctx.SaveChanges(); } }
public void DeleteTest() { //Create necessary list for seller. List<Property> propertyList = new List<Property>(); //Create the seller itself. Seller sellDatHouse = new Seller() { Name = "Mr. Sell D. House", Address = "Sofiendalsvej 60", Email = "*****@*****.**", Misc = "Han vil virkelig gerne have sit hus solgt", Mobile = "40528283", Phone = "40528283", ZipCode = "9000", Properties = propertyList }; //Save it to the database sCtr.InsertSeller(sellDatHouse); //Delete it again sCtr.DeleteSeller(sellDatHouse); //Try to retrieve the deleted seller again, and assert it is null. Seller sellDatHouseNew = sCtr.GetSellerByPhone(sellDatHouse.Mobile); Assert.IsNull(sellDatHouseNew); }
public void DeleteSeller(Seller seller) { sCtr.DeleteSeller(seller); }
public void AddPropertyToSeller(Seller seller, Property property) { sCtr.AddPropertyToSeller(seller, property); }
public void UpdateSellerSingle(Seller seller) { sCtr.UpdateSeller(seller); }
public void UpdateSeller(Seller seller, List<Property> properties, string name, string address, string zipCode, string phone, string mobil, string email, string misc) { sCtr.UpdateSeller(seller, properties, name, address, zipCode, phone, mobil, email, misc); }
public void InsertSeller(Seller seller) { sCtr.InsertSeller(seller); }
public List<Property> GetAllPropertiesFromSeller(Seller seller) { return sCtr.GetAllProperties(seller); }
public void UpdateSeller(Seller seller, List<Property> properties, string name, string address, string zipCode, string phone, string mobil, string email, string misc) { using (var ctx = new SystemContext()) { Seller s = ctx.Sellers.Where(x => x.Id == seller.Id).SingleOrDefault(); s.Name = name; s.Properties = properties; s.Address = address; s.ZipCode = zipCode; s.Phone = phone; s.Mobile = mobil; s.Email = email; s.Misc = misc; ctx.Entry(s).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public void DeleteSeller(Seller seller) { dbSel.DeleteSeller(seller); }
public void InsertSeller(Seller seller) { using (var ctx = new SystemContext()) { ctx.Sellers.Add(seller); ctx.SaveChanges(); } }
public void UpdateTest() { //Create necessary list for seller. List<Property> propertyList = new List<Property>(); //Create the seller itself. Seller sellDatHouse = new Seller() { Name = "Mr. Sell D. House", Address = "Sofiendalsvej 60", Email = "*****@*****.**", Misc = "Han vil virkelig gerne have sit hus solgt", Mobile = "40528283", Phone = "40528283", ZipCode = "9000", Properties = propertyList }; //Save it to the database sCtr.InsertSeller(sellDatHouse); //Change the seller: sCtr.UpdateSeller(sellDatHouse, propertyList, sellDatHouse.Name, sellDatHouse.Address, sellDatHouse.ZipCode, "112", sellDatHouse.Mobile, sellDatHouse.Email, sellDatHouse.Misc); //Test the assertion Assert.IsNotNull(sCtr.GetSellerByPhone("112")); sCtr.DeleteSeller(sellDatHouse); }
public List<Property> GetAllProperties(Seller seller) { return dbSel.GetAllProperties(seller); }
public void InsertSeller(Seller seller) { dbSel.InsertSeller(seller); }
public void UpdateSeller(Seller seller) { using (var ctx = new SystemContext()) { Seller dbSeller = ctx.Sellers.Find(seller.Id); ctx.Entry(dbSeller).CurrentValues.SetValues(seller); ctx.SaveChanges(); } }
public void InsertAppointment(Appointment appointment, Buyer buyer, Seller seller) { dbApp.InsertAppointment(appointment, buyer, seller); }
public void ReadTest() { //Create necessary list for seller. List<Property> propertyList = new List<Property>(); //Create the seller itself. Seller sellDatHouse = new Seller() { Name = "Mr. Sell D. House", Address = "Sofiendalsvej 60", Email = "*****@*****.**", Misc = "Han vil virkelig gerne have sit hus solgt", Mobile = "40528283", Phone = "40528283", ZipCode = "9000", Properties = propertyList }; //Save it to the database sCtr.InsertSeller(sellDatHouse); //Compare sellers. Assert.IsNotNull(sCtr.GetSellerByPhone("40528283")); sCtr.DeleteSeller(sellDatHouse); }
public void AddPropertyToSeller(Seller seller, Property property) { seller.Properties.Add(property); }
public void UpdateSeller(Seller seller) { dbSel.UpdateSeller(seller); }