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); }
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 });