Exemplo n.º 1
0
        public ActionResult RemoveItemFromBusket(int dealID)
        {
            //var deals = Session[DEALS_IN_THE_BUSKET] as List<PurchaseView>;
            //var dealtoRemove = deals.Where(d => d.ID == dealID).FirstOrDefault();

            //deals.Remove(dealtoRemove);

            //Session[DEALS_IN_THE_BUSKET] = deals;

            //TempData["Success"] = "Order Removed! ";
            ManagerQuery manager = new ManagerQuery();

            manager.DeletePurchas(dealID);
            return(RedirectToAction("MyBusket"));
        }
Exemplo n.º 2
0
        public ActionResult ManagerActions(CalcModel cm)
        {
            CalcModel result = new CalcModel();


            switch (cm.ManagerAction)
            {
            ///////// MODELS ///////////

            case "AddModel":
                return(PartialView("AddModel"));


            case "EditModel":
                var model = (from m in allmodels where m.ID == cm.ID select m).FirstOrDefault();
                return(PartialView("EditModel", model));


            /////////////  CARS /////////////

            case "AddCar":
                return(PartialView("AddCar"));


            case "AddPicture":
                var carp = (from c in allCars where c.ID == cm.ID select c).FirstOrDefault();
                return(PartialView("AddCarPicture", carp));


            case "EditCar":
                var car = (from c in allCars where c.ID == cm.ID select c).FirstOrDefault();
                return(PartialView("EditCar", car));


            case "DeleteCar":
                _manager.DeleteCar(cm.ID);
                CalcModel carresult = new CalcModel();
                carresult.ActionResult = "Model Deleted";
                return(Json(carresult, JsonRequestBehavior.AllowGet));


            /////////////// USERS ////////////////////

            case "AddUser":
                return(PartialView("AddUser"));



            case "EditUser":
                var customer = (from c in allCustomers where c.ID == cm.ID select c).FirstOrDefault();
                return(PartialView("EditUser", customer));



            case "EditEmployee":
                var employee = (from c in allEmployees where c.ID == cm.ID select c).FirstOrDefault();
                return(PartialView("EditUser", employee));


            case "DeleteCustomer":
                _manager.DeleteClient(cm.ID);
                CalcModel customerresult = new CalcModel();
                customerresult.ActionResult = "Model Deleted";
                return(Json(customerresult, JsonRequestBehavior.AllowGet));



            case "AddDeal":
                return(PartialView("AddDeal"));

            case "EditDeal":
                var deal = (from d in allDeals where d.ID == cm.ID select d).FirstOrDefault();
                return(PartialView("EditDeal", deal));

            case "DeleteDeal":
                _manager.DeletePurchas(cm.ID);
                CalcModel dealresult = new CalcModel();
                dealresult.ActionResult = "Model Deleted";
                return(Json(dealresult, JsonRequestBehavior.AllowGet));

            default:
                return(null);
            }
        }