public HttpResponseMessage UpdateWalletBalance(UserWalletViewModel objAddress)
        {
            try
            {
                User_Wallet objUserWallet = new User_Wallet();
                string      mobileNumber  = objAddress.MobileNumber;
                //get mobileNumber from user table
                var number = (from user in dbContext.Shop_Retailer_UserMaster where user.mobile_number == mobileNumber select user).FirstOrDefault();
                if (number != null)
                {
                    var CheckBalanceforUser = (from balance in dbContext.User_Wallet where balance.user_code == mobileNumber select balance).FirstOrDefault();
                    if (CheckBalanceforUser != null)
                    {
                        int Availablebalance   = Convert.ToInt32(CheckBalanceforUser.UserBalance);
                        int TobeDeductedAmount = Convert.ToInt32(objAddress.WalletBalance);
                        int totalAmount        = Availablebalance - TobeDeductedAmount;

                        objUserWallet.Id = CheckBalanceforUser.Id;
                        var getWalletInfo = (from balance in dbContext.User_Wallet where balance.Id == CheckBalanceforUser.Id select balance).FirstOrDefault();

                        getWalletInfo.UserBalance = totalAmount.ToString();

                        getWalletInfo.ModifiedDate = DateTime.Now;



                        dbContext.Entry(getWalletInfo).State = EntityState.Modified;
                        var i = dbContext.SaveChanges();
                        if (i != 0)
                        {
                            objResponse.Message = "Wallet balance updated successfully";
                            return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                        }
                        else
                        {
                            objResponse.Message = "Failed to add wallet balance.";
                            return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                        }
                    }
                    else
                    {
                        objResponse.Message = "Mobile number not exists.";

                        return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                    }
                }
                else
                {
                    objResponse.Message = "Mobile number not exists.";

                    return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        //[Authorize]
        //[Route("api/User/AddWalletBalance")]
        public HttpResponseMessage AddWalletBalance(UserWalletViewModel objAddress)
        {
            try
            {
                //  UserWalletViewModel objAddress = new UserWalletViewModel();
                User_Wallet objUserWallet = new User_Wallet();
                string      mobileNumber  = objAddress.MobileNumber;
                //get mobileNumber from user table
                var number = (from user in dbContext.Shop_Retailer_UserMaster where user.user_code == mobileNumber select user).FirstOrDefault();
                if (number != null)
                {
                    var CheckBalanceforUser = (from balance in dbContext.User_Wallet where balance.user_code == mobileNumber select balance).FirstOrDefault();
                    if (CheckBalanceforUser == null)
                    {
                        objUserWallet.Id          = objAddress.Id;
                        objUserWallet.UserBalance = objAddress.WalletBalance;
                        objUserWallet.user_code   = objAddress.MobileNumber;
                        //objUserWallet.Status = true;
                        objUserWallet.CreatedDate = DateTime.Now;



                        dbContext.User_Wallet.Add(objUserWallet);
                        var i = dbContext.SaveChanges();
                        if (i != 0)
                        {
                            objResponse.Message = "Wallet balance added successfully";
                            return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                        }
                        else
                        {
                            objResponse.Message = "Failed to add wallet balance.";
                            return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                        }
                    }
                    else
                    {
                        int Availablebalance = Convert.ToInt32(CheckBalanceforUser.UserBalance);
                        int TobeAddedAmount  = Convert.ToInt32(objAddress.WalletBalance);
                        int totalAmount      = Availablebalance + TobeAddedAmount;

                        objUserWallet.Id = CheckBalanceforUser.Id;
                        var getWalletInfo = (from balance in dbContext.User_Wallet where balance.Id == CheckBalanceforUser.Id select balance).FirstOrDefault();

                        getWalletInfo.UserBalance = totalAmount.ToString();

                        getWalletInfo.ModifiedDate = DateTime.Now;



                        dbContext.Entry(getWalletInfo).State = EntityState.Modified;
                        var i = dbContext.SaveChanges();
                        if (i != 0)
                        {
                            objResponse.Message = "Wallet balace added successfully";
                            return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                        }
                        else
                        {
                            objResponse.Message = "Failed to add wallet balance.";
                            return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                        }
                    }
                }
                else
                {
                    objResponse.Message = "Mobile number not exists.";

                    return(Request.CreateResponse(HttpStatusCode.OK, objResponse));
                }
            }
            catch (Exception ex)
            {
                //Log.Info(Convert.ToString(ex.InnerException));
                //Log.Info(ex.Message);
                //objCommonClasses.InsertExceptionDetails(ex, "UserController", "AddWalletBalance");
                objResponse.Message = "Mobile number not exists.";
                return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.Message));
            }
        }