Exemple #1
0
        public async Task <ClsResponseModel> CustomerReturnAsync(ClsCustomerPurchase clsCustomer)
        {
            ClsResponseModel clsResponse = new ClsResponseModel();
            var parameters = new DynamicParameters();

            parameters.Add("@UserId", clsCustomer.UserId);
            parameters.Add("@DepositReturnAmount", clsCustomer.DepositAmount);
            parameters.Add("@Createdby", clsCustomer.BusinessId);
            parameters.Add("@Productid", clsCustomer.ProductId);
            parameters.Add("@Quantity", clsCustomer.Quantity);
            parameters.Add("@Businessid", clsCustomer.BusinessId);
            int returnValue = await this._dbContext.ExecuteAsync("USP_Custreturn", parameters, commandType : CommandType.StoredProcedure);

            if (returnValue > 0)
            {
                clsResponse.IsSuccess = true;
                clsResponse.ErrorCode = 200;
                clsResponse.Message   = "Purchase successfully.";
            }
            else
            {
                clsResponse.IsSuccess = false;
                clsResponse.ErrorCode = 400;
                clsResponse.Message   = "Purchase failed";
            }
            return(clsResponse);
        }
Exemple #2
0
        public async Task <ActionResult> CustomerReturn(ClsCustomerPurchase clsCustomerReturn)
        {
            clsCustomerReturn.BusinessId = Convert.ToInt32(Session["businessId"]);
            ClsResponseModel purchaseResponse = await this._product.CustomerReturnAsync(clsCustomerReturn);

            if (purchaseResponse.IsSuccess)
            {
                return(Json(new { Status = 1 }));
            }
            else
            {
                return(Json(new { Status = 0 }));
            }
        }
Exemple #3
0
        public async Task <ActionResult> CustomerPurchase(ClsCustomerPurchase clsCustomerPurchase)
        {
            clsCustomerPurchase.BusinessId      = Convert.ToInt32(Session["businessId"]);
            clsCustomerPurchase.IsDepositGiven  = true;
            clsCustomerPurchase.IsDepositReturn = false;

            clsCustomerPurchase.SubCategoryId = clsResponseModel.Data.Where(x => x.SubCategoryName == clsCustomerPurchase.SubCategoryId).Select(y => y.SubCategoryId).FirstOrDefault().ToString();
            clsCustomerPurchase.CategoryId    = clsResponse.Data.Where(x => x.CategoryName == clsCustomerPurchase.CategoryId).Select(y => y.CategoryId).FirstOrDefault().ToString();

            ClsResponseModel purchaseResponse = await this._product.CustomerPurchaseAsync(clsCustomerPurchase);

            if (purchaseResponse.IsSuccess)
            {
                return(Json(new { Status = 1 }));
            }
            else
            {
                return(Json(new { Status = 0 }));
            }
        }