Exemplo n.º 1
0
        public async Task <Tuple <bool, string> > SaveFranchiseRequest(FranchiseRequestResponse franchiseRequestResponse)
        {
            Tuple <bool, string>     requestResult           = null;
            FranchiseRequestResponse franchisRequestResponse = new FranchiseRequestResponse();
            int requestStatus = -1;

            try
            {
                var parameters = new DynamicParameters();
                using (SqlConnection cxn = new SqlConnection(_dcDb))
                {
                    parameters.Add("@UserID", userID, DbType.Int32);
                    parameters.Add("@StatusID", franchiseRequestResponse.StatusID, DbType.Int32);
                    parameters.Add("@CreatedBy", userID, DbType.Int32);

                    requestStatus = await cxn.ExecuteScalarAsync <int>("dbo.Insert_FranchiseUserRequests", parameters, commandType : CommandType.StoredProcedure);
                }

                if (requestStatus == 0)
                {
                    requestResult = Tuple.Create(true, "Your franchise request has been successfull.");
                }
                else
                {
                    requestResult = Tuple.Create(false, "Your franchise request has been failed.Please try again.");
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
                requestResult = Tuple.Create(false, "Oops! Your franchise request has been failed.Please try again.");
            }

            return(requestResult);
        }
Exemplo n.º 2
0
        public async Task <Tuple <bool, string> > ApproveFranchiseRequest(FranchiseRequestResponse franchiseRequestResponse)
        {
            Tuple <bool, string> result = null;

            try
            {
                result = await _repo.ApproveFranchiseRequest(franchiseRequestResponse);
            }
            catch (Exception ex)
            {
                ErrorLog.Write(ex);
            }

            return(result);
        }