//Leased vehicle - for the main page
 //The mange of this category is in the worker area
 public ActionResult leasedVehicleIndex()
 {
     try
     {
         LeasedVehicleLogic logic = new LeasedVehicleLogic();
         return(View("LeasedVehicle", logic.GetAllVehicles()));
     }
     catch (Exception)
     {
         ViewBag.Error = "We have problem on the server, Please try again later!";
         return(View("LeasedVehicle", new List <LeasedVehicle>()));
     }
 }
Beispiel #2
0
        //return to ajax the user orders / BadRequest
        public ActionResult UserOrders()
        {
            try
            {
                LeasedVehicleLogic logic = new LeasedVehicleLogic();


                return(Json(logic.UserOrders(User.Identity.Name), JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "We have problem on the server, Please try again later!"));
            }
        }
        //Edit LeasedVehicle page - show only
        public ActionResult Edit(int id)
        {
            try
            {
                LeasedVehicleLogic logic = new LeasedVehicleLogic();

                return(View(logic.GetOneLeasedVehicleDetails(id)));
            }
            catch (Exception)
            {
                ViewBag.Error         = "We have problem on the server, Please try again later!";
                ViewBag.CriticalError = true;
                return(View(new VehiclesType()));
            }
        }
        public ActionResult Edit(LeasedVehicle editDate)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                LeasedVehicleLogic logic = new LeasedVehicleLogic();
                logic.EditLeasedVehicles(editDate);

                return(RedirectToAction("Index", "ReturnVehicle"));
            }
            catch (Exception)
            {
                ViewBag.Error = "We have problem on the server, Please try again later!";
                return(View(new LeasedVehicle()));
            }
        }
        public ActionResult Delete(LeasedVehicle deleteLeasedVehicle)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                using (LeasedVehicleLogic logic = new LeasedVehicleLogic())
                {
                    logic.DeleteLeasedVehicles(deleteLeasedVehicle);
                }

                return(RedirectToAction("Index", "MangeHome"));
            }
            catch
            {
                ViewBag.Error = "We have problem on the server, Please try again later!";
                return(View(new LeasedVehicle()));
            }
        }