Ejemplo n.º 1
0
        public async Task <ActionResult> ScheduleItemRemove([FromForm] ScheduleItemDto data)
        {
            await LightingProxy.DeleteScheduleItem(data.Hostname, data.Hour, data.Minute);

            return(new ViewComponentResult()
            {
                ViewComponentName = SettingsViewComponent.Name
            });
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> ScheduleItemAdd([FromForm] ScheduleItemDto data)
        {
            data.Wrgb = data.Wrgb.Trim('#');

            if (Int32.TryParse(data.Wrgb.Trim('#'), System.Globalization.NumberStyles.HexNumber, null, out int wrgbHex))
            {
                var colour = Color.FromArgb((int)wrgbHex);
                await LightingProxy.AddScheduleItem(data.Hostname, data.Hour, data.Minute, colour.R, colour.G, colour.B, colour.A);

                return(new ViewComponentResult()
                {
                    ViewComponentName = SettingsViewComponent.Name
                });
            }

            return(new BadRequestResult());
        }