コード例 #1
0
        public ActionResult <IEnumerable <Cat> > Get()
        {
            string sortBy = HttpContext.Request.Query["sortBy"].ToString();

            switch (sortBy)
            {
            case "elo":
                return(Ok(_catService.Get(CatService.SortBy.elo, true)));

            case "occurence":
                return(Ok(_catService.Get(CatService.SortBy.occurence)));

            default:
                return(Ok(_catService.Get()));
            }
        }
コード例 #2
0
        public async Task ShouldLoadCatWithDependency_WhenFilterAskTo()
        {
            using (var dbContext = DbContextFixture.GetDbContext())
            {
                var service = new CatService(new HttpService(), dbContext, IConfigMock.GetCatsMock());
                var cat     = await service.Get(1, new RequestOptions()
                {
                    IncludeMatchHistory = true
                }).ConfigureAwait(false);

                Assert.NotNull(cat);
                Assert.NotNull(cat.Rank);
                Assert.NotNull(cat.Informations);
                Assert.Empty(cat.Informations.History);
            }
        }
コード例 #3
0
        public async Task <IActionResult> GetMatch()
        {
            MatchIds matchIds = await MatchService.FindMatchAsync().ConfigureAwait(false);

            var options = new RequestOptions()
            {
                IncludeMatchHistory = false
            };

            Cat left = await CatService.Get(matchIds.Left, options).ConfigureAwait(false);

            Cat right = await CatService.Get(matchIds.Right, options).ConfigureAwait(false);

            MatchFoundResponse matchFound = new MatchFoundResponse()
            {
                Left = left.ToApiModel(), Right = right.ToApiModel()
            };

            var response = new CommonResponse <MatchFoundResponse>(ResponseCode.Success, "Ok", matchFound);

            return(Ok(response));
        }
コード例 #4
0
        public IActionResult Get()
        {
            var cats = _service.Get();

            return(Ok(cats));
        }
コード例 #5
0
 public async Task <IReadOnlyCollection <CatDTO> > Get()
 {
     return(await _service.Get());
 }
コード例 #6
0
ファイル: CatController.cs プロジェクト: orloffm/kakao
 public IEnumerable <Cat> Get()
 {
     return(_catService.Get());
 }