Пример #1
0
        public async Task <AddResultResponse> AddCoreResultAsync(long aoUkprn, ManageCoreResultViewModel viewModel)
        {
            var grades = await _internalApiClient.GetLookupDataAsync(LookupCategory.PathwayComponentGrade);

            var selectedGrade = grades?.FirstOrDefault(x => x.Code.Equals(viewModel.SelectedGradeCode, StringComparison.InvariantCultureIgnoreCase));

            if (selectedGrade == null)
            {
                return(null);
            }

            viewModel.LookupId = selectedGrade.Id;
            var request = _mapper.Map <AddResultRequest>(viewModel, opt => opt.Items["aoUkprn"] = aoUkprn);

            return(await _internalApiClient.AddResultAsync(request));
        }