public JsonResult AddToCart(AddToCartModel objmodel) { AddToCart objAddToCart = new AddToCart(); return objAddToCart.AddToCartFun(objmodel, this.ControllerContext.HttpContext); }
private void PreRequiestCheckout() { LoginModel MdUser = Services.GetLoginWebUser(this.ControllerContext.HttpContext, _JwtTokenManager); AddToCart objAddToCart = new AddToCart(); ViewBag.LoginEmail = MdUser.EmailId; ViewBag.RegisterType = MdUser.RegisterType; ViewBag.ItemCount = objAddToCart.GetItemCount(this.ControllerContext.HttpContext); ViewBag.TotalAmount = objAddToCart.GetTotalAmountCheckOut(this.ControllerContext.HttpContext); if (ViewBag.TotalAmount < Constant.MinimumAmountForFreeDelivery) { ViewBag.ShippingCharges = Constant.ShippingCharges; //setting shipping/delivery charges ViewBag.TotalAmountAfterCharges = ViewBag.TotalAmount + ViewBag.ShippingCharges; } else { ViewBag.ShippingCharges = 0; ViewBag.TotalAmountAfterCharges = ViewBag.TotalAmount; } ViewBag.UserAddress = GetUserAddress(); bindCountryStateCity(); }
public decimal GetTotalAmount(List <AddToCartModel> ListCart) { AddToCart objAddToCart = new AddToCart(); return(objAddToCart.GetTotalAmount(ListCart)); }
public JsonResult RemoveToCart(int index) { AddToCart objAddToCart = new AddToCart(); return(objAddToCart.RemoveCart(index, this.ControllerContext.HttpContext)); }
public ActionResult GetCoupon(string CouponCode) { CouponModel ObjCouponModel = new CouponModel(); LoginModel MdUser = Services.GetLoginWebUser(this.ControllerContext.HttpContext, _JwtTokenManager); if (MdUser.Id != 0) { ObjCouponModel.UserId = Convert.ToInt64(MdUser.Id); } ObjCouponModel.CouponCode = CouponCode; var _request = JsonConvert.SerializeObject(ObjCouponModel); ResponseModel ObjResponse = CommonFile.GetApiResponse(Constant.ApiGetCoupon, _request); var ObjResponse1 = JsonConvert.DeserializeObject <List <ResponseModel> >(ObjResponse.Response); var couponresponse = ObjResponse1[0].Response.ToString(); if (couponresponse.Equals("already used")) { ViewBag.CouponResponse = "Coupon already used"; return(JavaScript("swal('coupon already used')")); } if (couponresponse.Equals("coupon expired")) { ViewBag.CouponResponse = "coupon expired"; return(JavaScript("swal('Coupon Expired')")); } if (couponresponse.Equals("coupon does not exist")) { ViewBag.CouponResponse = "coupon does not exist"; return(JavaScript("swal('Coupon does not exist')")); } else { if (iscouponapplied == false) { string[] ArrResponse = couponresponse.Split(','); if (ArrResponse[3] == "Discount") //if coupon type is "discount" { ViewBag.CouponResponse = ArrResponse[6]; AddToCart objAddToCart = new AddToCart(); var totalamount = objAddToCart.GetTotalAmountCheckOut(this.ControllerContext.HttpContext); if (totalamount < Convert.ToInt64(ArrResponse[4])) { return(JavaScript("swal('Cart value is not sufficient')")); } ViewBag.TotalAmount = totalamount - Convert.ToInt64(ArrResponse[2]); if (ViewBag.TotalAmount <= Constant.MinimumAmountForFreeDelivery) { ViewBag.TotalAmount += Constant.ShippingCharges; //Adding shipping/delivery charges ViewBag.TotalAmount -= (2 * (ViewBag.TotalAmount)); //making the total negative for handling it securely in client side ViewBag.TotalAmountAfterCharges = ViewBag.TotalAmount; } totalamount = ViewBag.TotalAmount; SaleOrderModel objmodel = new SaleOrderModel(); objmodel.TotalAmount = totalamount; ObjCouponModel.IsCouponApplied = true; iscouponapplied = true; objmodel.IsCouponApplied = true; return(Json(ViewBag.TotalAmount)); } else if (ArrResponse[3] == "BOGO") //Condition for Coupon Type=="BOGO" (Buy One Get One) { return(JavaScript("swal('Coupon does not exist')")); } return(JavaScript("swal('Error')")); } return(JavaScript("swal('Error')")); } }
public JsonResult AddToCartTojquery(AddToCartModel objmodel) { AddToCart objAddToCart = new AddToCart(); JsonResult json = objAddToCart.AddToCartFun(objmodel, this.ControllerContext.HttpContext); return json; }