1.4.5.Edit form

  • Create an edit action in controller

        public ActionResult Edit(int id)
        {
            var customer = _context.Customers.SingleOrDefault(c => c.Id == id);

            if (customer == null)
            {
                return HttpNotFound();
            }
            var viewModel = new CustomerFormViewModel
            {
                customer = customer,
                MembershipTypes = _context.membershipType.ToList()
            };

            return View("CustomerForm", viewModel);
        }

Last updated