コード例 #1
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id is null)
            {
                return(NotFound());
            }

            var division = await _divisionRepository.GetDivisionAsync(id.Value);

            if (division is null)
            {
                return(NotFound());
            }

            _divisionsDetailsViewModel.Division = division;

            return(View(_divisionsDetailsViewModel));
        }
コード例 #2
0
        public async Task <IHttpActionResult> Get(string divisionReference)
        {
            bool converts = int.TryParse(divisionReference, out int divisionId);

            if (converts == false)
            {
                return(BadRequest());
            }

            DatabaseAccess.ExternalModel.Division databaseDivision = await _divisionRepository.GetDivisionAsync(divisionId);

            if (databaseDivision == null)
            {
                return(NotFound());
            }

            Models.Division division = Models.Division.Convert(databaseDivision);

            division.Link = Url.Content("~/") + "division/" + databaseDivision.DivisionId;

            return(Ok(division));
        }