Ejemplo n.º 1
0
        public async Task <BaseResponse> GetCheckResult(int id)
        {
            var checkResult = await _anagramDbContext.CheckResults.Include(x => x.WordCheckResults).ThenInclude(x => x.Word).FirstOrDefaultAsync(x => x.Id == id);

            if (checkResult.IsNull())
            {
                return(new BaseResponse("Invalid result ID"));
            }

            var result = new CheckResultDTO
            {
                AreAnagrams = checkResult.AreAnagrams,
                FirstWord   = checkResult.WordCheckResults.FirstOrDefault().Word.DecodedString,
                SecondWord  = checkResult.WordCheckResults.LastOrDefault().Word.DecodedString,
            };

            return(result);
        }
Ejemplo n.º 2
0
        public IActionResult GetResults(int id)
        {
            CheckResultDTO CheckResultDTO = new CheckResultDTO();
            var            check          = _CheckRepositry.GetById(id);

            if (check != null)
            {
                CheckResultDTO.id           = check.id;
                CheckResultDTO.Lock         = check.Lock;
                CheckResultDTO.ownerid      = check.ownerid;
                CheckResultDTO.useraction   = check.useraction;
                CheckResultDTO.Done         = check.Done;
                CheckResultDTO.count        = check.count;
                CheckResultDTO.create       = check.create;
                CheckResultDTO.description  = check.description;
                CheckResultDTO.CheckResults = _CheckResultRepositry.GetAll().Where(s => s.orderid == id).ToList();
                return(Ok(CheckResultDTO));
            }
            return(BadRequest());
        }