Exemplo n.º 1
0
        public bool CanBeCured(PlantItem plant)
        {
            PlantSystem sys = plant.PlantSystem;

            if (plant.PlantStatus >= PlantStatus.DecorativePlant)
            {
                return(false);
            }
            else if (sys.Fungus == 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public bool CanBePoisoned(PlantItem plant)
        {
            PlantSystem sys = plant.PlantSystem;

            if (plant.PlantStatus >= PlantStatus.DecorativePlant)
            {
                return(false);
            }
            else if (sys.Infestation == 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public bool CanBeStr(PlantItem plant)
        {
            PlantSystem sys = plant.PlantSystem;

            if (plant.PlantStatus >= PlantStatus.DecorativePlant)
            {
                return(false);
            }
            else if (sys.Disease == 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        public async Task <ActionResult> stopWatering(Guid plantToken, int duration)
        {
            try
            {
                var wateringHardware = new WateringHardwareSystem();
                wateringHardware.stopWatering();

                var plantSystem = new PlantSystem(_configs);

                var result = await plantSystem.addWateringRecored(plantToken, duration);

                return(Ok(result));
            }
            catch (Exception e1)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e1.Message));
            }
        }
Exemplo n.º 5
0
        public async Task <ActionResult> getAll( )
        {
            try
            {
                var plantSystem          = new PlantSystem(_configs);
                List <PlantModel> result = await plantSystem.getAll();

                if (result != null && result.Count > 0)
                {
                    return(Ok(new JsonResult(result)));
                }
                else
                {
                    return(Ok());
                }
                //    return StatusCode((int)HttpStatusCode.NotFound,  "No data found" );
            }
            catch (Exception e1)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e1.Message));
            }
        }