示例#1
0
        public CategoriaDTO Delete(CategoriaExclusaoModel model)
        {
            var id        = Guid.Parse(model.IdCategoria);
            var categoria = categoriaDomainService.GetById(id);

            categoriaDomainService.Delete(categoria);

            return(mapper.Map <CategoriaDTO>(categoria));
        }
        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));
            }
        }