Beispiel #1
0
        public ActionResult <WaterPlantResponseDTO> WaterPlant(long id)
        {
            WaterPlantResponseDTO responseDTO = new WaterPlantResponseDTO();

            Console.Error.Write(Thread.CurrentThread);
            //using (Timer timer = new Timer(new TimerCallback((c) =>
            //{
            //    Console.Error.Write("what the f**k");
            //}), null, 3000, 1000))
            //{

            //    // Wait for 10 seconds
            //    Thread.Sleep(10000);

            //    // Then go slow for another 10 seconds
            //    timer.Change(0, 2000);
            //    Thread.Sleep(10000);
            //}

            WaterPlantResponse response = service.WaterPlant(new Services.Arguments.WaterPlantArguments(id));

            if (response.Successful)
            {
                responseDTO.Plant = mapper.Map <PlantDTO>(response.Plant);
            }

            responseDTO.ErrorMessage = response.ErrorMessage;
            responseDTO.Successful   = response.Successful;
            return(Accepted(responseDTO));
        }
Beispiel #2
0
        public ActionResult <WaterPlantResponseDTO> StopWateringPlant(long id)
        {
            WaterPlantResponseDTO responseDTO = new WaterPlantResponseDTO();

            WaterPlantResponse response = service.StopWateringPlant(new Services.Arguments.StopWateringPlantArguments(id));

            if (response.Successful)
            {
                responseDTO.Plant = mapper.Map <PlantDTO>(response.Plant);
            }

            responseDTO.ErrorMessage = response.ErrorMessage;
            responseDTO.Successful   = response.Successful;
            return(Accepted(responseDTO));
        }