File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,15 +50,8 @@ public IActionResult UpdateCategorieTask([FromBody] CategorieTaskEntity model)
5050 {
5151 try
5252 {
53- CategorieTaskEntity categorieToUpdate = new ( )
54- {
55- Name = model . Name ,
56- Description = model . Description
57- } ;
58-
59- _context . CategorieTasks . Update ( categorieToUpdate ) ;
60- _context . SaveChanges ( ) ;
61- return Ok ( "Categoria de tarefa atualizada com sucesso." ) ;
53+ var categorieTask = _categorieTaskService . UpdateCategorieTask ( model ) ;
54+ return Ok ( categorieTask ) ;
6255 }
6356 catch ( Exception ex )
6457 {
Original file line number Diff line number Diff line change @@ -46,5 +46,25 @@ public IActionResult CreateCategorieTask([FromBody] CategorieTaskEntity model)
4646 }
4747 }
4848
49+ public IActionResult UpdateCategorieTask ( [ FromBody ] CategorieTaskEntity model )
50+ {
51+ try
52+ {
53+ CategorieTaskEntity categorieToUpdate = new ( )
54+ {
55+ Name = model . Name ,
56+ Description = model . Description
57+ } ;
58+
59+ _context . CategorieTasks . Update ( categorieToUpdate ) ;
60+ _context . SaveChanges ( ) ;
61+ return Ok ( "Categoria de tarefa atualizada com sucesso." ) ;
62+ }
63+ catch ( Exception ex )
64+ {
65+ return BadRequest ( "Não foi possível atualizar a categoria de tarefa." ) ;
66+ }
67+ }
68+
4969 }
5070}
You can’t perform that action at this time.
0 commit comments