Exemplo n.º 1
0
        public ActionResult Confimation(int dealID)
        {
            //var deals = Session[DEALS_IN_THE_BUSKET] as List<PurchaseView>;

            //var currenDeal = deals.Where(d => d.ID == dealID).FirstOrDefault();

            //deals.Remove(currenDeal);

            //Session[DEALS_IN_THE_BUSKET] = deals;

            //_customer.PurcaseConfirmation(currenDeal.ReturnDateDetails());

            //TempData["Success"] = "Reservation Completed!";

            //return RedirectToAction("PreviousReservations");
            try
            {
                if (User == null || string.IsNullOrEmpty(User.Identity.Name))
                {
                    return(Json(new { IsOk = 0 }, JsonRequestBehavior.AllowGet));
                }
                ManagerQuery manager    = new ManagerQuery();
                var          _Purchases = manager.AllPurchases().Where(p => p.ID == dealID).FirstOrDefault();
                _Purchases.PurchasesStatus = 1;
                manager.UpdatePurchase(_Purchases);
                return(Json(new { IsOk = 1, Url = Url.Action("MyBusket", "Customer") }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new { IsOk = -1 }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 2
0
 public ActionResult MakeOrder(DateTime DateStart, DateTime DateEnd)
 {
     try
     {
         if (User == null || string.IsNullOrEmpty(User.Identity.Name))
         {
             return(Json(new { data = true, url = Url.Action("Login", "Home") }, JsonRequestBehavior.AllowGet));
         }
         var UserID  = manager.GetAllUsers().Where(p => p.UserName == User.Identity.Name).Select(p => p.ID).FirstOrDefault();
         var listPur = manager.AllPurchases().Where(p => p.UserId == UserID && (!p.PurchasesStatus.HasValue || p.PurchasesStatus.Value == 0)).ToList();
         if (listPur.Count > 0)
         {
             foreach (var pur in listPur)
             {
                 pur.PurchaseDate    = DateStart;
                 pur.ReturnDate      = DateEnd;
                 pur.PurchasesStatus = 0;
                 pur.Price           = guest.PriceOfCar(pur.CarID.Value);
                 manager.UpdatePurchase(pur);
             }
         }
         return(Json(new { data = true, url = Url.Action("MyBusket", "Customer") }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { data = true, url = Url.Action("Login", "Home") }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 3
0
        public ActionResult SubmitEditDeal(PurchaseView pv)
        {
            if (ModelState.IsValid)
            {
                var managerHelper = new CalcModel();
                _manager.UpdatePurchase(pv.ReturnDateDetails());
                managerHelper.ActionResult = "Deal edit submitted";
                return(Json(managerHelper, JsonRequestBehavior.AllowGet));
            }

            else
            {
                return(PartialView("EditDeal", pv));
            }
        }