-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(services)!: add Player mapping to UpdateAsync, add test cases
- Loading branch information
1 parent
6b07f5f
commit 4fa5795
Showing
5 changed files
with
132 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Dotnet.Samples.AspNetCore.WebApi/Data/PlayerDataExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Dotnet.Samples.AspNetCore.WebApi.Models; | ||
|
||
namespace Dotnet.Samples.AspNetCore.WebApi.Data; | ||
|
||
public static class PlayerDataExtensions | ||
{ | ||
/// <summary> | ||
/// Simple extension method to map all properties of a Player | ||
/// </summary> | ||
public static void MapFrom(this Player target, Player source) | ||
{ | ||
target.FirstName = source.FirstName; | ||
target.MiddleName = source.MiddleName; | ||
target.LastName = source.LastName; | ||
target.DateOfBirth = source.DateOfBirth; | ||
target.SquadNumber = source.SquadNumber; | ||
target.Position = source.Position; | ||
target.Team = source.Team; | ||
target.League = source.League; | ||
target.Starting11 = source.Starting11; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters