Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var policySvc = new PolicyLogic(Ticket);

            var policyObj = policySvc.GetById(id);

            ViewData.Model = policyObj;
            ViewData["productId"] = BuildProductList(policyObj.Product.Id);

            return View();
        }
Ejemplo n.º 2
0
        public ActionResult Display(int id)
        {
            var vehicleSvc = new VehicleLogic(Ticket);
            var policySvc = new PolicyLogic(Ticket);

            var policyObj = policySvc.GetById(id);
            var vehicleObj = vehicleSvc.GetById(policyObj.VehicleId);

            ViewData.Model = policyObj;
            ViewData["vehicle"] = vehicleObj;

            return View();
        }
Ejemplo n.º 3
0
        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 });
        }