Skip to content

Instantly share code, notes, and snippets.

@profesor79
Last active February 22, 2023 00:48
Show Gist options
  • Save profesor79/ae43a18b1aef7db1cb98086bfec71779 to your computer and use it in GitHub Desktop.
Save profesor79/ae43a18b1aef7db1cb98086bfec71779 to your computer and use it in GitHub Desktop.
code review pain killer
public AShityLongClassModel HandleNullValueWithModel(List<AShityLongClass> some_Results)
{
var result = some_Results[0];
var model = new AShityLongClassModel
{
P1 = result.P1.HasValue ? result.P1.Value : 0,
P11 = result.P11.HasValue ? result.P11.Value : 0,
P12 = result.P12.HasValue ? result.P12.Value : 0,
P13 = result.P13.HasValue ? result.P13.Value : 0,
P14 = result.P14.HasValue ? result.P14.Value : 0,
P15 = result.P15.HasValue ? result.P15.Value : 0,
P2 = result.P2.HasValue ? result.P2.Value : 0,
P21 = result.P21.HasValue ? result.P21.Value : 0,
P22 = result.P22.HasValue ? result.P22.Value : 0,
P23 = result.P23.HasValue ? result.P23.Value : 0,
P24 = result.P24.HasValue ? result.P24.Value : 0,
P25 = result.P25.HasValue ? result.P25.Value : 0,
P3 = result.P3.HasValue ? result.P3.Value : 0,
P31 = result.P31.HasValue ? result.P31.Value : 0,
P32 = result.P32.HasValue ? result.P32.Value : 0,
P33 = result.P33.HasValue ? result.P33.Value : 0,
};
return model;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment