public IEnumerable <GameDTO> GetGamesByPlatform(PlatformTypeDTO platform) { return(_db.GetRepository <PlatformType>().Get(platform.Id).Games.Select(game => new GameDTO { Id = game.Id, Name = game.Name, Description = game.Description, Key = game.Key })); }
public static void Validate(PlatformTypeDTO type) { if (type == null) { throw new ValidationException("Cannot create type from null", "PlatformType"); } if (type.Translates.Any(x => string.IsNullOrEmpty(x.Name))) { throw new ValidationException("Property name cannot be empty: PlatformTypeDTO", "Name"); } }