Exemplo n.º 1
0
        public async Task <IActionResult> UpdateSlideLayer(SlideLayer model, string layerSubmit)
        {
            if (layerSubmit == "false")
            {
                return(Ok());
            }

            if (ModelState.IsValid)
            {
                //the ui might need to change. The modal window is posting all
                //form elements which triggers the layer form to be posted without data.
                //TODO  change the ui to only render the form element within the component.
                if (string.IsNullOrEmpty(model.Id))
                {
                    return(Ok());
                }

                var layer = await _slideShowService.GetLayerAsync(model.Id);

                if (layer == null)
                {
                    _slideShowService.SaveLayer(model);
                }
                else
                {
                    //TODO remove the "not null" on table creation and remove the following defaults.
                    layer.Title = model.Title;
                    layer.HorizontalAlignment = model.HorizontalAlignment;
                    layer.VerticalAlignment   = Alignment.Center;
                    layer.Color          = model.Color;
                    layer.SourceUrl      = model.SourceUrl;
                    layer.FontFamily     = model.FontFamily;
                    layer.FontSize       = model.FontSize;
                    layer.X              = model.X;
                    layer.Y              = model.Y;
                    layer.Transition     = model.Transition;
                    layer.Position       = model.Position;
                    layer.LayerType      = model.LayerType;
                    layer.Delay          = model.Delay;
                    layer.Target         = model.Target;
                    layer.FontWeight     = model.FontWeight;
                    layer.FontStyle      = model.FontStyle;
                    layer.BgColor        = model.BgColor;
                    layer.TextDecoration = model.TextDecoration;
                    //layer.FadeInTransition = Transition.Blinds;
                    //layer.FadeInDirection = Direction.BottomToTop;
                    //layer.FadeInDuration = 1;
                    //layer.FadeOutDelay = 1;
                    //layer.FadeOutDirection = Direction.BottomToTop;
                    //layer.FadeOutDuration = 1;
                    //layer.FadeOutTransition = Transition.Blinds;

                    _slideShowService.UpdateLayer(layer);
                }

                return(Ok(model));
            }

            return(BadRequest(ModelState));
        }
Exemplo n.º 2
0
 private async Task <SlideLayer> GetSlideLayer(string id)
 {
     return(await _slideService.GetLayerAsync(id));
 }