Ejemplo n.º 1
0
        public void Add(Customer customer)
        {
            using (var ctx = new MovieStoreContext())
            {

                ctx.Customers.Add(customer);
                ctx.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public ActionResult Create(Customer cus, FormCollection collection)
 {
     if (ModelState.IsValid)
     {
         fac.GetCustomerRepository().Add(cus);
         return RedirectToAction("Index");
     }
         return View();
 }
Ejemplo n.º 3
0
 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();
     }
 }
Ejemplo n.º 4
0
 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);
 }