public async Task <IActionResult> UpdateCode([FromBody] Code UpdateCode) { var Response = new SingleResponse <Code>(); try { int result = await _ICodeRepository.UpdateCodeAsync(UpdateCode); if (result == 0) { Response.DidError = true; Response.Message = $"The Code with the id: {UpdateCode.CodeId} was not found in the database."; _Logger.LogError(ControllerContext, Response.Message); } else { Response.Message = $"Successfully updated the code with the id: {UpdateCode.CodeId}."; Response.Model = UpdateCode; _Logger.LogInfo(ControllerContext, $"Code with the id: {UpdateCode.CodeId} has been updated."); } } catch (Exception ex) { Response.DidError = true; Response.Message = "Internal Server Error."; _Logger.LogError(ControllerContext, $"Error Message: {ex.Message}"); } return(Response.ToHttpResponse()); }