File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
NorthwindCRUD/Controllers Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 33 using AutoMapper ;
44 using Microsoft . AspNetCore . Authorization ;
55 using Microsoft . AspNetCore . Mvc ;
6+ using NorthwindCRUD . Models . Contracts ;
67 using NorthwindCRUD . Models . DbModels ;
78 using NorthwindCRUD . Models . InputModels ;
89 using NorthwindCRUD . Services ;
@@ -92,7 +93,13 @@ public ActionResult<EmployeeInputModel> Update(EmployeeInputModel model)
9293 {
9394 var mappedModel = this . mapper . Map < EmployeeInputModel , EmployeeDb > ( model ) ;
9495 var employee = this . employeeService . Update ( mappedModel ) ;
95- return Ok ( this . mapper . Map < EmployeeDb , EmployeeInputModel > ( employee ) ) ;
96+
97+ if ( employee != null )
98+ {
99+ return Ok ( this . mapper . Map < EmployeeDb , EmployeeInputModel > ( employee ) ) ;
100+ }
101+
102+ return NotFound ( ) ;
96103 }
97104
98105 return BadRequest ( ModelState ) ;
You can’t perform that action at this time.
0 commit comments