예제 #1
0
        public ActionResult <Marca> Put([FromBody] Marca marca)
        {
            var _marca = _marcaService.Atualizar(marca);

            if (_marca != null)
            {
                return(Ok(_marca));
            }
            else
            {
                return(NoContent());
            }
        }
예제 #2
0
        public async Task <IActionResult> Edit(Guid id, MarcaViewModel marcaViewModel)
        {
            if (id != marcaViewModel.Id)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(View(marcaViewModel));
            }

            var marca = _mapper.Map <Marca>(marcaViewModel);
            await _marcaService.Atualizar(marca);

            return(View(_mapper.Map <MarcaViewModel>(await _marcaRepository.ObterPorId(id))));
        }
예제 #3
0
        public async Task <Marca> Edit(Guid id, Marca marca)
        {
            await _marcaService.Atualizar(marca);

            return(await _marcaRepository.ObterPorId(id));
        }