Example #1
0
        public ActionResult AddShelterToCart(int?product, int?prodQuantity)
        {
            var msgType = false;
            var msg     = Requestor.Req_Cart_ErrorNoShelter;

            try
            {
                if (Application.LoggedRequestorId != null)
                {
                    var userId = (int)Application.LoggedRequestorId;

                    if (product != null && prodQuantity != null)
                    {
                        var prodId   = (int)product;
                        var prodQuan = (float)prodQuantity;

                        CartRepository.AddProductToCart(userId, prodId, prodQuan);

                        msgType = true;
                        msg     = Requestor.Req_Cart_ShelterAdded;
                    }
                }
                else
                {
                    msg = Common.ErrorMsgForSession;
                }
            }
            catch (Exception e)
            {
                msg = e.Message;
                Logger.LogError(e, "Error while adding shelter to cart from Requestor zone");
            }

            return(Json(new
            {
                success = msgType,
                message = msg
            }));
        }