예제 #1
0
        public static List <ShipDto> ToListShipDto(List <Ship> ships)
        {
            var shipsDto = new List <ShipDto>();

            foreach (var item in ships)
            {
                var shipDto = new ShipDto(item);
                shipsDto.Add(shipDto);
            }
            return(shipsDto);
        }
예제 #2
0
 public static Ship ToEntity(ShipDto shipDto)
 {
     return(new Ship()
     {
         Id = shipDto.Id ?? default,
         Type = (ShipType)Enum.Parse(typeof(ShipType), shipDto.Type),
         Level = shipDto.Level ?? default,
         Hp = shipDto.Hp ?? default,
         Attack = shipDto.Attack ?? default,
         Defence = shipDto.Defence ?? default,
         StartedAt = shipDto.StartedAt,
         FinishedAt = shipDto.FinishedAt
     });