public IActionResult Get(string firstLetter, [FromQuery] ApiParams apiParams) { var model = _service.GetCategories(firstLetter, apiParams); return(Ok(model)); }
public PagedList GetCategories(string firstLetter, ApiParams apiParams) { var query = _categories.Where(c => c.Code.ToLower().StartsWith(firstLetter.ToLower())) .AsQueryable(); return(FilterAndReturnPagedList(apiParams, ref query)); }
public IActionResult GetFromCategory(string id, [FromQuery] ApiParams apiParams) { var model = _service.GetCodesFromCategory(id, apiParams); return(Ok(model)); }
public PagedList GetCodesFromCategory(string categoryCode, ApiParams apiParams) { var query = _codes.Where(c => c.Category.Code == categoryCode) .AsQueryable(); return(FilterAndReturnPagedList(apiParams, ref query)); }
/// <summary> /// 开始写入执行日志 /// </summary> /// <param name="param">传入参数</param> /// <param name="action">方法名</param> /// <returns></returns> public t_logs AddBeginLogs(ApiParams param, string action) { t_logs m = new t_logs(); m.ctype = "xxkj_api_logs"; m.action = action; m.ip = param.ip; m.accout = param.accout; m.param = param.paramMain + "/" + param.paramDetails; m.b_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); return(m); }
private static PagedList FilterAndReturnPagedList(ApiParams apiParams, ref IQueryable <ICD10Category> query) { var filterBy = apiParams.FilterBy.Trim().ToLowerInvariant(); if (!string.IsNullOrEmpty(filterBy)) { query = query .Where(m => m.Title.ToLowerInvariant().Contains(filterBy) || m.Code.ToLowerInvariant().Contains(filterBy)); } return(new PagedList(query, apiParams.PageNumber, apiParams.PageSize)); }
static PagedList FilterAndReturnPagedList(ApiParams apiParams, ref IQueryable <ICD9Code> query) { var filterBy = apiParams.FilterBy.Trim().ToLowerInvariant(); if (!string.IsNullOrEmpty(filterBy)) { query = query .Where(m => m.LongDescription.ToLowerInvariant().Contains(filterBy) || m.ShortDescription.ToLowerInvariant().Contains(filterBy) || m.Code.ToLowerInvariant().Contains(filterBy)); } return(new PagedList(query, apiParams.PageNumber, apiParams.PageSize)); }
public ApiResponse <ArenaTeamReportOpposingTeams> GetArenaTeamReportOpposingTeams(int teamSize, string teamName, Realm realm) { if (realm.GetRealmExpansion() > Expansion.Cataclysm) { return new ApiResponse <ArenaTeamReportOpposingTeams>() { CustomError = CustomError.InvalidRealm, ErrorMessage = InvalidExpansion } } ; ApiParams param = new ApiParams(Endpoints.ArenaTeamReportOpposingTeams, Secret, new ArenaTeamRequest(teamSize, teamName, realm)); return(Communicate <ArenaTeamReportOpposingTeams>(param)); }
public ApiResponse <ArenaLadder> GetArenaLadder(int teamSize, Realm realm) { if (realm.GetRealmExpansion() > Expansion.Cataclysm) { return new ApiResponse <ArenaLadder>() { CustomError = CustomError.InvalidRealm, ErrorMessage = InvalidExpansion } } ; ApiParams param = new ApiParams(Endpoints.ArenaLadder, Secret, new ArenaLadderRequest(teamSize, realm)); return(Communicate <ArenaLadder>(param)); }
public ApiResponse <AuctionHouseInfoResponse> GetBlackMarketInfo(Realm realm) { if (realm.GetRealmExpansion() < Expansion.MistsOfPandaria) { return new ApiResponse <AuctionHouseInfoResponse>() { ErrorMessage = InvalidExpansion } } ; ApiParams param = new ApiParams(Endpoints.AuctionsInfo, Secret, new AuctionHouseBaseRequest(realm)); return(Communicate <AuctionHouseInfoResponse>(param)); }
public async Task <ApiResponse <BlackMarketResponse> > GetBlackMarketAuctionsAsync(Realm realm) { if (realm.GetRealmExpansion() < Expansion.MistsOfPandaria) { return new ApiResponse <BlackMarketResponse>() { ErrorMessage = InvalidExpansion } } ; ApiParams param = new ApiParams(Endpoints.AuctionsData, Secret, new AuctionHouseBaseRequest(realm)); return(await CommunicateAsync <BlackMarketResponse>(param)); }
public async Task <ApiResponse <ArenaTeamGameChart> > GetArenaTeamGameChartAsync(int teamSize, string teamName, Realm realm) { if (realm.GetRealmExpansion() > Expansion.Cataclysm) { return new ApiResponse <ArenaTeamGameChart>() { CustomError = CustomError.InvalidRealm, ErrorMessage = InvalidExpansion } } ; ApiParams param = new ApiParams(Endpoints.ArenaTeamGameChart, Secret, new ArenaTeamRequest(teamSize, teamName, realm)); return(await CommunicateAsync <ArenaTeamGameChart>(param)); }
public ApiResponse <ArenaGame> GetArenaGame(int matchId, Realm realm) { if (realm.GetRealmExpansion() > Expansion.Cataclysm) { return new ApiResponse <ArenaGame>() { CustomError = CustomError.InvalidRealm, ErrorMessage = InvalidExpansion } } ; ApiParams param = new ApiParams(Endpoints.ArenaGame, Secret, new ArenaGameRequest(matchId, realm)); return(Communicate <ArenaGame>(param)); }
public async Task <ActionResult <VmPage <VmCountryList> > > List([FromQuery] ApiParams apiParams) { var results = await _listService.Get(new PageParams { PageIndex = apiParams.PageIndex, PageSize = apiParams.PageLimit, }); return(Ok(new VmPage <VmCountryList> { Items = VmCountryList.Build(results), PageIndex = results.PageIndex, PageSize = results.PageSize, TotalCount = results.Total })); }
public async Task Returns_OkResult_With_PageResults() { // Arrange const int pageSize = 15; const int pageIndex = 2; const int totalItems = 31; const int totalPageCount = 3; var queryResults = new PageResults <Country> { PageSize = pageSize, PageIndex = pageIndex, Total = totalItems }; GetMock <ICountryListService>() .Setup(x => x.Get( It.Is <PageParams>(p => p.PageSize == pageSize && p.PageIndex == pageIndex) )) .Returns(Task.FromResult(queryResults)); // Act var apiParams = new ApiParams { PageIndex = pageIndex, PageLimit = pageSize }; var result = await ClassUnderTest.List(apiParams); // Assert var okResult = Assert.IsType <OkObjectResult>(result.Result); var returnValue = Assert.IsType <VmPage <VmCountryList> >(okResult.Value); returnValue.PageSize.Should().Be(pageSize); returnValue.PageIndex.Should().Be(pageIndex); returnValue.TotalCount.Should().Be(totalItems); returnValue.TotalPageCount.Should().Be(totalPageCount); }
public static async Task <bool> DoLogin(string username, string password) { try { var methodParam = new ApiParams(); methodParam.Add("idUsuario", username); methodParam.Add("clave", password); var userJson = await APICaller.Call("ValidarAccesoMovil", methodParam); var user = Models.User.FromJsonToken(userJson); if (user == null) { return(false); } Models.Shared.User = user; return(true); } catch { return(false); } }
public ApiResponse <CharacterReputation> GetCharacterReputation(string characterName, Realm realm) { ApiParams param = new ApiParams(Endpoints.Reputation, Secret, new CharacterRequest(characterName, realm)); return(Communicate <CharacterReputation>(param)); }
public async Task <ApiResponse <CharacterSheet> > GetCharacterSheetAsync(string characterName, Realm realm) { ApiParams param = new ApiParams(Endpoints.TooltipUrl, Secret, new CharacterRequest(characterName, realm)); return(await CommunicateAsync <CharacterSheet>(param)); }
public IActionResult Get([FromQuery] ApiParams apiParams) { var model = _service.GetCodes(apiParams); return(Ok(model)); }
public async Task <ApiResponse <CharacterReputation> > GetCharacterReputationAsync(string characterName, Realm realm) { ApiParams param = new ApiParams(Endpoints.Reputation, Secret, new CharacterRequest(characterName, realm)); return(await CommunicateAsync <CharacterReputation>(param)); }
public async Task <ApiResponse <CharacterAchievementsLoader> > GetCharacterAchievementsLoaderAsync(string characterName, int categoryId, Realm realm) { ApiParams param = new ApiParams(Endpoints.AchievementsLoader, Secret, new AchievementsLoaderRequest(characterName, categoryId, realm)); return(await CommunicateAsync <CharacterAchievementsLoader>(param)); }
public async Task <ApiResponse <CharacterAchievements> > GetCharacterAchievementsAsync(string characterName, Realm realm) { ApiParams param = new ApiParams(Endpoints.CharacterAchievements, Secret, new CharacterAchievementsRequest(characterName, realm)); return(await CommunicateAsync <CharacterAchievements>(param)); }
public async Task <ApiResponse <AchievementFirst> > GetAchievementFirstsAsync(Realm realm) { ApiParams param = new ApiParams(Endpoints.AchievementFirsts, Secret, new AchievementBaseRequest(realm)); return(await CommunicateAsync <AchievementFirst>(param)); }
public ApiResponse <CharacterSheet> GetCharacterSheet(string characterName, Realm realm) { ApiParams param = new ApiParams(Endpoints.TooltipUrl, Secret, new CharacterRequest(characterName, realm)); return(Communicate <CharacterSheet>(param)); }
public retmsg ProWare(ApiParams param) { retmsg ret = new retmsg(); string constr = ""; //起始日志 t_logs LogsModel = new Bll.CommBll.LogsBll().AddBeginLogs(param, "ProWare"); //获取数据库链接 ret = new Bll.CommBll.AccoutBll().getAccout(param.ip, param.accout); constr = ret.message; if (ret.flag == "error") { //结尾日志--失败 new Bll.CommBll.LogsBll().AddEndLogs(LogsModel, ret.flag, ret.message); return(ret); } try { //翻译参数 //主表 MyRdRecord01 model; using (System.IO.StringReader sr = new System.IO.StringReader(param.paramMain)) { model = (MyRdRecord01) new Newtonsoft.Json.JsonSerializer().Deserialize(new JsonTextReader(sr), typeof(MyRdRecord01)); } //子表 List <MyRdRecords01> list; using (System.IO.StringReader sr = new System.IO.StringReader(param.paramDetails)) { list = (List <MyRdRecords01>) new Newtonsoft.Json.JsonSerializer().Deserialize(new JsonTextReader(sr), typeof(List <MyRdRecords01>)); } //检测参数 ret = new Bll.MyU8Bll.CheckParamData().CheckMyRd01(model, list, constr); if (ret.flag == "error") { //throw new Exception(ret.message); //结尾日志--失败 new Bll.CommBll.LogsBll().AddEndLogs(LogsModel, ret.flag, ret.message); return(ret); } //检测是不是已经记账 ret = new Bll.CommBll.GL_mend().CheckGL_mend(model.create_date, constr); if (ret.flag == "error") { //结尾日志--失败 new Bll.CommBll.LogsBll().AddEndLogs(LogsModel, ret.flag, ret.message); return(ret); } //翻译字段 list = new Bll.MyU8Bll.TransField().TransFieldMyRd01(list, constr); model.bredvouch = 0;//蓝单标识 //调用方法 --主表部门字段,子表金额数量等字段待处理 ret = new Bll.MyU8Bll.MyRd01Bll().Add(model, list, constr); //结尾日志--完成 new Bll.CommBll.LogsBll().AddEndLogs(LogsModel, ret.flag, ret.message); return(ret); } catch (Exception ex) { ret.flag = "error"; ret.message = "001:" + ex.Message; //结尾日志--失败 new Bll.CommBll.LogsBll().AddEndLogs(LogsModel, ret.flag, ret.message); return(ret); } }
public ApiResponse <AchievementFirst> GetAchievementFirsts(Realm realm) { ApiParams param = new ApiParams(Endpoints.AchievementFirsts, Secret, new AchievementBaseRequest(realm)); return(Communicate <AchievementFirst>(param)); }
public PagedList GetCodes(ApiParams apiParams) { var query = _codes.AsQueryable(); return(FilterAndReturnPagedList(apiParams, ref query)); }
public ApiResponse <CharacterAchievements> GetCharacterAchievements(string characterName, Realm realm) { ApiParams param = new ApiParams(Endpoints.CharacterAchievements, Secret, new CharacterAchievementsRequest(characterName, realm)); return(Communicate <CharacterAchievements>(param)); }
public ApiResponse <GuildBankLog> GetGuildBankLogs(string guildName, Realm realm = Realm.Evermoon) { ApiParams param = new ApiParams(Endpoints.GuildBankLogs, Secret, new GuildRequest(guildName, realm)); return(Communicate <GuildBankLog>(param)); }
public async Task <ApiResponse <AuctionHouseResponse> > GetAuctionsByItemIDAsync(int itemID, Realm realm) { ApiParams param = new ApiParams(Endpoints.AuctionItemData, Secret, new AuctionHouseItemPriceRequest(itemID, realm.ToMasterRealm())); return(await CommunicateAsync <AuctionHouseResponse>(param)); }