internal static Game ToDBModel(this App.Game game) { return(new Game { Id = game.Id, Name = game.Name, ImageId = game.Image?.Id, State = game.State, Comment = game.Comment, Date = game.Date }); }
internal static void UpdateFrom(this Game dbGame, App.Game game) { var mapedGame = game.ToDBModel(); if (dbGame.Name != mapedGame.Name) { dbGame.Name = mapedGame.Name; } if (dbGame.ImageId != mapedGame.ImageId) { dbGame.ImageId = mapedGame.ImageId; } if (dbGame.State != mapedGame.State) { dbGame.State = mapedGame.State; } if (dbGame.Comment != mapedGame.Comment) { dbGame.Comment = mapedGame.Comment; } }