public void Add(Customer customer) { using (var ctx = new MovieStoreContext()) { ctx.Customers.Add(customer); ctx.SaveChanges(); } }
public ActionResult Create(Customer cus, FormCollection collection) { if (ModelState.IsValid) { fac.GetCustomerRepository().Add(cus); return RedirectToAction("Index"); } return View(); }
public void UpdateCustomer(Customer customer) { using (var ctx = new MovieStoreContext()) { Customer m = ctx.Customers.Where(x => x.Id == customer.Id).First(); m.FirstName = customer.FirstName; m.LastName = customer.LastName; m.Address = customer.Address; m.Email = customer.Email; m.orders = customer.orders; ctx.SaveChanges(); } }
public void AddCustomer(CustomerViewModel newViewCustomer) { Customer newCustomer = new Customer() { FirstName = newViewCustomer.FirstName, LastName = newViewCustomer.LastName, Address = newViewCustomer.Address, Email = newViewCustomer.Email, orders = new List<Order>() }; new MoviesStoreProxy.Repository.Facade().GetCustomerRepository().Add(newCustomer); }