예제 #1
0
            public async Task <Unit> Handle(Command request, CancellationToken cancellationToken)
            {
                var plantEntry = new PlantEntry
                {
                    PlantId          = request.PlantId,
                    NutrientRecipeId = request.NutrientRecipeId,
                    Title            = request.Title,
                    Comment          = request.Comment,
                    SoilSaturation   = request.SoilSaturation,
                    PH               = request.PH,
                    Height           = request.Height,
                    BudTrichomeColor = request.BudTrichomeColor,
                    GrowState        = request.GrowState,
                    ColaSize         = request.ColaSize,
                    AverageBudSize   = request.AverageBudSize,
                    StalkDiameter    = request.StalkDiameter,
                    Tags             = request.Tags,
                    Editors          = request.Editors,
                    Created          = DateTime.Now,
                    LastUpdated      = DateTime.Now
                };

                _context.PlantEntries.Add(plantEntry);
                var success = await _context.SaveChangesAsync() > 0;

                if (success)
                {
                    return(Unit.Value);
                }

                throw new Exception("Problem saving changes");
            }
        public override void ChildDeserialize(GenericReader reader)
        {
            int version = reader.ReadEncodedInt();

            switch (version)
            {
                case 0:
                    m_iLevel = reader.ReadEncodedInt();
                    break;
            }

            m_PlantEntry = GetCurrentPlantEntry();
            if (CurProgress > MaxProgress)
                CurProgress = MaxProgress - 1;
        }
 public FindPlantObjective(int level)
 {
     m_iLevel = level;
     m_PlantEntry = GetCurrentPlantEntry();
 }