public ActionResult Open(long valveId) { Valve valveDto = _valveService.Get(valveId); Raspberry raspberry = raspberryService.Get(valveDto.RaspberryId); string ip = raspberry.IPAddress; if (string.IsNullOrWhiteSpace(ip)) { throw new Exception(" IP address of Valve can not found!"); } string url = $"http://{ip}/{valveDto.EnablePin}"; Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"\n\n\n\n{raspberry.IPAddress} valve:{valveDto.RaspberryId} opening\n{url}\n\n\n"); Console.ForegroundColor = ConsoleColor.White; valveDto.IsOpen = true; _valveService.Update(valveDto); Get(url); return(Ok(200)); }
public RaspberryResponseModel Get(long id) { Raspberry dtoItem = _raspberryService.Get(id); RaspberryResponseModel item = ModelBinder.Instance.ConvertToRaspberryResponseModel(dtoItem); return item; }