AssocAddEdit.Controllers.VehiclesController.Edit C# (CSharp) Method

Edit() public method

public Edit ( int id ) : System.Web.Mvc.ActionResult
id int
return System.Web.Mvc.ActionResult
        public ActionResult Edit(int? id)
        {
            // Attempt to fetch the matching object
            var o = m.VehicleGetByIdWithDetail(id.GetValueOrDefault());

            if (o == null)
            {
                return HttpNotFound();
            }
            else
            {
                // Create and configure an "edit form"

                // Notice that o is a CustomerBase object
                // We must map it to a CustomerEditContactInfoForm object
                // Notice that we can use AutoMapper anywhere, 
                // and not just in the Manager class!
                var form = AutoMapper.Mapper.Map<VehicleEditForm>(o);

                return View(form);
            }
        }

Same methods

VehiclesController::Edit ( int id, VehicleEdit newItem ) : System.Web.Mvc.ActionResult