public static IEnumerable <Customer> GetAll() { using (var context = new HomeCornerContext()) { return(context.Customers.Include("Customer").ToList()); } }
public static Customer GetById(int Id) { using (var context = new HomeCornerContext()) { return(context.Customers.Include("Customer").SingleOrDefault(m => m.Id == Id)); } }
public static House GetById(int Id) { using (var context = new HomeCornerContext()) { return(context.Houses.Include("House").SingleOrDefault(m => m.Id == Id)); } }
public static IEnumerable <House> GetAll() { using (var context = new HomeCornerContext()) { return(context.Houses.Include("House").ToList()); } }
public static void Add(Customer customer) { using (var context = new HomeCornerContext()) { context.Customers.Add(customer); context.SaveChanges(); } }
public static void Add(House house) { using (var context = new HomeCornerContext()) { context.Houses.Add(house); context.SaveChanges(); } }
public static void Delete(int id) { using (var context = new HomeCornerContext()) { Customer customer = context.Customers.Find(id); context.Customers.Remove(customer); context.SaveChanges(); } }
public static void Delete(int id) { using (var context = new HomeCornerContext()) { House house = context.Houses.Find(id); context.Houses.Remove(house); context.SaveChanges(); } }
public static void Update(Customer customer) { using (var context = new HomeCornerContext()) { Customer customerToUpdate = context.Customers.Find(customer.Id); customer.Id = customer.Id; customerToUpdate.Name = customer.Name; customerToUpdate.Address = customer.Address; context.SaveChanges(); } }
public static void Update(House house) { using (var context = new HomeCornerContext()) { House houseToUpdate = context.Houses.Find(house.Id); house.Id = house.Id; houseToUpdate.Title = house.Title; context.SaveChanges(); } }