Exemplo n.º 1
0
        public async Task <IActionResult> AtualizarChamado(string id, [FromBody] ChamadoDTO chamadoDto)
        {
            try
            {
                await _chamadoService.Atualizar(id, chamadoDto);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(Guid id, ChamadoViewModel chamadoViewModel)
        {
            if (id != chamadoViewModel.Id)
            {
                return(NotFound());
            }

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

            await _chamadoService.Atualizar(_mapper.Map <Chamado>(chamadoViewModel));

            if (!OperacaoValida())
            {
                return(View(chamadoViewModel));
            }

            return(RedirectToAction("Index"));
        }