public ActionResult Delete(Customer customer)
        {
            var customerInDb = CustomerDb.GetById(customer.Id);

            // update properties

            CustomerDb.Delete(customerInDb);
            return(RedirectToAction("Index", "Customers"));
        }
        public ActionResult Save(Customer customer)
        {
            if (customer.Id == 0)
            {
                CustomerDb.Add(customer);
            }
            else
            {
                var customerInDb = CustomerDb.GetById(customer.Id);
                // update properties
                customerInDb.Name = customer.Name;

                CustomerDb.Update(customerInDb);
            }
            return(RedirectToAction("Index", "Customers"));
        }
        public ActionResult Delete(int Id)
        {
            var customerInDb = CustomerDb.GetById(Id);

            return(View(customerInDb));
        }
Example #4
0
 public Customer GetById(int id)
 {
     return(CustomerDb.GetById(id));
 }