public ActionResult Edit(int id, FormCollection form) { var policySvc = new PolicyLogic(Ticket); var productSvc = new ProductLogic(Ticket); int productId = StringUtility.ToInt(form["productId"]); var startDate = StringUtility.ToDateTime(form["startDate"]); var startDistance = StringUtility.ToInt(form["startDistance"]); var policyObj = policySvc.GetById(id); policyObj.StartDate = startDate.Value; policyObj.StartDistance = startDistance; policyObj.Product.Id = productId; policySvc.Update(policyObj); return RedirectToAction("Display", "Vehicle", new { id = policyObj.VehicleId }); }
private SelectList BuildProductList(int productId) { var productSvc = new ProductLogic(Ticket); var productList = productSvc.GetAll(); return new SelectList(productList, "Id", "Name", productId); }