Exemplo n.º 1
0
        public async Task <IActionResult> GetAllAsync()
        {
            // var result = _mapper.Map<IEnumerable<DapperDto>>(await _uow.dapperRepository.GetAllAsync().ConfigureAwait(false));
            var result = await _dapperService.GetAllAsync().ConfigureAwait(false);

            return(Ok(result));
        }
        public async Task <ApiResponse> GetAllAsync()
        {
            var _apiResponse = new ApiResponse();
            var _param       = new DynamicParameters();

            _param.Add("@SuccessMsg", null, DbType.String, ParameterDirection.Output);
            _param.Add("@IsSuccess", 0, DbType.Int16, ParameterDirection.Output);

            var data = await _dapperService.GetAllAsync <User>("API_GetAllUser", _param, CommandType.StoredProcedure);

            _apiResponse.Message = _param.Get <string>("SuccessMsg");
            _apiResponse.Status  = _param.Get <Int16>("IsSuccess") == 1 ? true : false;
            _apiResponse.Data    = data;

            return(_apiResponse);
        }
Exemplo n.º 3
0
        public async Task <ApiResponse> GetAllCountries()
        {
            var _apiRes = new ApiResponse();

            var dbPara = new DynamicParameters();

            dbPara.Add("@SuccessMsg", null, DbType.String, ParameterDirection.Output);
            dbPara.Add("@IsSuccess", 0, DbType.Int16, ParameterDirection.Output);

            _apiRes.Data = Task.FromResult(await _dapperService.GetAllAsync <Country>("API_GetAllCountries", dbPara, CommandType.StoredProcedure)).Result;

            _apiRes.Message = dbPara.Get <string>("SuccessMsg");
            _apiRes.Status  = dbPara.Get <Int16>("IsSuccess") == 1 ? true : false;
            return(_apiRes);
        }
        public async Task <ApiResponse> GetUserPermissionAsync(Int64 id)
        {
            var _apiResponse = new ApiResponse();
            var _param       = new DynamicParameters();

            _param.Add("@orole_id", id, DbType.Int32);
            _param.Add("@SuccessMsg", null, DbType.String, ParameterDirection.Output);
            _param.Add("@IsSuccess", 0, DbType.Int16, ParameterDirection.Output);

            var result = await _dapperService.GetAllAsync <RolePermission>("API_GetRolePermissions", _param, CommandType.StoredProcedure);

            _apiResponse.Data    = result;
            _apiResponse.Message = _param.Get <string>("SuccessMsg");
            _apiResponse.Status  = _param.Get <Int16>("IsSuccess") == 1 ? true : false;

            return(_apiResponse);
        }