コード例 #1
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                DeleteCategoriaCommand command = new DeleteCategoriaCommand()
                {
                    Id = id
                };
                await categoriaApplicationService.Delete(command);

                return(Ok(new { message = "Categoria excluída com sucesso!" }));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
コード例 #2
0
        public IActionResult Delete(string id)
        {
            try
            {
                var model = new CategoriaExclusaoModel()
                {
                    IdCategoria = id
                };
                var result = categoriaApplicationService.Delete(model);

                return(Ok(new
                {
                    Message = "Categoria excluído com sucesso.",
                    Categoria = result
                }));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }