/// <summary> /// to get cart details /// </summary> /// <returns></returns> public ActionResult GetCartDetails() { try { string mobileNumber = LoggedInUser.MobileNumber; var getCartDetails = ObjICommonServices.GetCartDetails(mobileNumber); double Totalsum = 0; foreach (var sum in getCartDetails) { double Totalprice = Convert.ToDouble(sum.TotalPrice); Totalsum += Totalprice; } var getUserDetailByMobile = ObjIUserService.GetuserInfo(mobileNumber); //ViewBag.UserName = getUserDetailByMobile.retailer_name==null?"N/A": getUserDetailByMobile.retailer_name; //ViewBag.Email = getUserDetailByMobile.email_id==null?"N/A": getUserDetailByMobile.email_id; //ViewBag.MobileNumber = getUserDetailByMobile.mobile_number; ViewBag.TotalPricePartial = Totalsum; ViewBag.TotalPrice = Totalsum + 20; //LoggedInUser.AmountToBePaid = ViewBag.TotalPrice; return(PartialView("~/Views/User/GetCartDetailsForUser.cshtml", getCartDetails)); } catch (Exception ex) { throw ex; } }
/// <summary> /// payment method /// </summary> /// <param name="addressId"></param> /// <returns></returns> public ActionResult PaymentMethod(string addressId = "") { try { string mobileNumber = LoggedInUser.MobileNumber; var getCartDetails = ObjICommonServices.GetCartDetails(mobileNumber); double Totalsum = 0; foreach (var sum in getCartDetails) { double Totalprice = Convert.ToDouble(sum.TotalPrice); Totalsum += Totalprice; } ViewBag.TotalPrice = Totalsum; double ttlPrice = ViewBag.TotalPrice; var AddOrder = ObjIUserService.AddOrderDetails(mobileNumber, ttlPrice, addressId); { var getUserDetailByMobile = ObjIUserService.GetuserInfo(mobileNumber); ViewBag.UserName = getUserDetailByMobile.retailer_name == null ? "N/A" : getUserDetailByMobile.retailer_name; ViewBag.Email = getUserDetailByMobile.email_id == null ? "N/A" : getUserDetailByMobile.email_id; ViewBag.MobileNumber = getUserDetailByMobile.mobile_number; ViewBag.TotalPricePartial = Totalsum; ViewBag.TotalPrice = Totalsum + 20; double amount = (ViewBag.TotalPrice) * 100; //int receipt = AddOrder; //to get razor pay OrderID #region API call to create orderID string orderID = GetRazorPayOrderID(amount); #endregion ViewBag.OrderID = orderID; ViewBag.ServerOrderID = AddOrder; return(View()); } } catch (Exception ex) { throw ex; } }
/// <summary> /// to get product in cart info /// </summary> /// <returns></returns> public ActionResult ProductInCartInfo() { try { string mobileNumber = LoggedInUser.MobileNumber; var getCartDetails = ObjICommonServices.GetCartDetails(mobileNumber); double Totalsum = 0; foreach (var sum in getCartDetails) { double Totalprice = Convert.ToDouble(sum.TotalPrice); Totalsum += Totalprice; } ViewBag.TotalPricePartial = Totalsum; return(PartialView("~/Views/Order/ProductInCartInfo.cshtml", getCartDetails)); } catch (Exception ex) { throw ex; } }