public PenetrationDataPointDto ToDto()
        {
            var dto = new PenetrationDataPointDto()
            {
                Id    = this.Id,
                Angle = new AngleDto()
                {
                    Id = this.angle.Id, Angle = this.angle.angle
                },
                Armor = new ArmorDto()
                {
                    Id = this.armor.Id, Armor = this.armor.armor
                },
                Penetration = new PenetrationDto()
                {
                    Id = this.penetration.Id, Penetration = this.penetration.penetration
                },
                ShellSize = new ShellSizeDto()
                {
                    Id = this.shellSize.Id, Size = this.shellSize.Size
                },
                ShellType = new ShellTypeDto()
                {
                    Id = this.shellType.Id, Type = this.shellType.Type
                },
                WillPen = this.WillPen
            };

            return(dto);
        }
 public PenetrationDataPoint(PenetrationDataPointDto dto)
 {
     Reset();
     armor.Id       = dto.Armor.Id;
     angle.Id       = dto.Angle.Id;
     penetration.Id = dto.Penetration.Id;
     shellSize.Id   = dto.ShellSize.Id;
     shellType.Id   = dto.ShellType.Id;
 }
        public async void ClassifyItem(PenetrationDataPointDto dto)
        {
            if (dto == null)
            {
                return;
            }

            var result = NaiveBayes.CanPenetrate(Penetrations, dto);

            PenetrationDataPointRepository penetrationDataPointRepository = new PenetrationDataPointRepository(new PenetrationDataContext());
            await penetrationDataPointRepository.UpdatePenetration(dto.Id, result);

            LoadPenetrations();
        }
Exemple #4
0
        public async Task CreateNewDataPoint(PenetrationDataPointDto penetrationDataPoint)
        {
            var dataPoint = new PenetrationDataPoint()
            {
                angleId       = penetrationDataPoint.Angle.Id,
                armorId       = penetrationDataPoint.Armor.Id,
                penetrationId = penetrationDataPoint.Penetration.Id,
                shellSizeId   = penetrationDataPoint.ShellSize.Id,
                shellTypeId   = penetrationDataPoint.ShellType.Id,
                WillPen       = penetrationDataPoint.WillPen,
                angle         = await Context.Angles.FirstOrDefaultAsync(a => a.Id == penetrationDataPoint.Angle.Id),
                armor         = await Context.Armors.FirstOrDefaultAsync(a => a.Id == penetrationDataPoint.Armor.Id),
                penetration   = await Context.Penetrations.FirstOrDefaultAsync(a => a.Id == penetrationDataPoint.Penetration.Id),
                shellSize     = await Context.ShellSizes.FirstOrDefaultAsync(a => a.Id == penetrationDataPoint.ShellSize.Id),
                shellType     = await Context.ShellTypes.FirstOrDefaultAsync(a => a.Id == penetrationDataPoint.ShellType.Id)
            };

            await Add(dataPoint).ConfigureAwait(true);
            await SaveChanges();
        }