Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateAsync(ModifyPublisherViewModel publisherViewModel)
        {
            var dto = _mapper.Map <ModifyPublisherDto>(publisherViewModel);
            await _publisherServices.UpdateAsync(dto);

            _logger.LogDebug($"Update publisher with id {publisherViewModel.Id}");

            return(NoContent());
        }
Ejemplo n.º 2
0
        private static ModifyPublisherViewModel CreateModifyPublisherViewModel()
        {
            var publisher = new ModifyPublisherViewModel
            {
                Id          = "1",
                CompanyName = CompanyName,
                HomePage    = "Home"
            };

            return(publisher);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> CreateAsync(ModifyPublisherViewModel viewModel)
        {
            viewModel.Id = Guid.NewGuid().ToString();

            var dto = _mapper.Map <ModifyPublisherDto>(viewModel);
            await _publisherServices.CreateAsync(dto);

            _logger.LogDebug($"Create new publisher with name {viewModel.CompanyName}");

            return(CreatedAtAction(nameof(GetByIdAsync), new { id = viewModel.Id }, viewModel));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> UpdateAsync(ModifyPublisherViewModel publisherViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Update", publisherViewModel));
            }

            var dto = _mapper.Map <ModifyPublisherDto>(publisherViewModel);
            await _publisherServices.UpdateAsync(dto);

            _logger.LogDebug($"Update publisher with id {publisherViewModel.Id}");

            return(RedirectToAction(nameof(GetAllAsync)));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> CreateAsync(ModifyPublisherViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("Create", viewModel));
            }

            var dto = _mapper.Map <ModifyPublisherDto>(viewModel);
            await _publisherServices.CreateAsync(dto);

            _logger.LogDebug($"Create new publisher with name {viewModel.CompanyName}");

            return(RedirectToAction(nameof(GetAllAsync)));
        }
Ejemplo n.º 6
0
        private static ModifyPublisherViewModel GetModifyPublisherViewModel()
        {
            var viewModel = new ModifyPublisherViewModel();

            return(viewModel);
        }