Exemplo n.º 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()));
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
        public IActionResult Get()
        {
            var cats = _service.Get();

            return(Ok(cats));
        }
Exemplo n.º 5
0
 public async Task <IReadOnlyCollection <CatDTO> > Get()
 {
     return(await _service.Get());
 }
Exemplo n.º 6
0
 public IEnumerable <Cat> Get()
 {
     return(_catService.Get());
 }