Esempio n. 1
0
 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
     }));
 }
Esempio n. 2
0
 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");
     }
 }