Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateAsync(string id)
        {
            var genreDto = await _platformServices.GetByIdAsync(id);

            var viewModel = _mapper.Map <PlatformViewModel>(genreDto);

            return(View("Update", viewModel));
        }
Ejemplo n.º 2
0
        public void UpdateAsync_ReturnsViewModelWithAssignedParentGenres_Always()
        {
            var testDto       = CreatePlatformDto();
            var testViewModel = CreatePlatformViewModel();

            A.CallTo(() => _platformService.GetByIdAsync(Id)).Returns(testDto);
            A.CallTo(() => _mapper.Map <PlatformViewModel>(testDto)).Returns(testViewModel);

            var result = _platformController.UpdateAsync(Id).Result as ViewResult;
            var model  = result.Model as PlatformViewModel;

            model.Id.Should().Be(Id);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetAsync(int id)
        {
            var result = await _platformService.GetByIdAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var PlatformResource = _mapper.Map <Platform, PlatformResource>(result.Resource);

            return(Ok(PlatformResource));
        }