public IHttpActionResult PutWebContent(int id, Models.WebContent webContent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != webContent.Id)
            {
                return(BadRequest());
            }

            db.Entry(webContent).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WebContentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public void CreateHeroImageText(int newColumnId)
        {
            Models.WebContent       webContent = new Models.WebContent();
            GlobalContentDBEntities db         = new GlobalContentDBEntities();

            using (db)
            {
                if (webContent.Id == default(int))
                {
                    webContent.ColumnId = newColumnId;

                    //SETTING Global

                    //Set text
                    webContent.TextBody = "Your site name here";
                    //Set position: absolute
                    webContent.position = "absolute";
                    //Set left 30%
                    webContent.left = "30%";
                    //Font color
                    webContent.color = "#f6f6f6";
                    //Set font size:
                    webContent.fontSize = "90px";
                    //Set bottom to 500px
                    webContent.bottom = "500px";
                    //Set font family
                    webContent.fontFamily = "Work Sans";

                    //SETTING MOBILE
                    webContent.textMobile     = "Your site name here";
                    webContent.positionMobile = "absolute";
                    webContent.leftMobile     = "18%";
                    webContent.bottomMobile   = "350px";
                    webContent.fontSizeMobile = "40px";

                    //SETTING TABLET
                    webContent.textTablet     = "Your site name here";
                    webContent.positionTablet = "absolute";
                    webContent.leftTablet     = "25%";
                    webContent.bottomTablet   = "250px";
                    webContent.fontSizeTablet = "60px";


                    //SETTING LAPTOP
                    webContent.textLaptop     = "Your site name here";
                    webContent.positionLaptop = "absolute";
                    webContent.leftLaptop     = "30%";
                    webContent.bottomLaptop   = "300px";
                    webContent.fontSizeLaptop = "60px";

                    db.WebContents.Add(webContent);
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }
        public void CreateHalfPageHeroImage(int newColumnId)
        {
            Models.WebContent       webContent = new Models.WebContent();
            GlobalContentDBEntities db         = new GlobalContentDBEntities();

            using (db)
            {
                if (webContent.Id == default(int))
                {
                    webContent.ColumnId = newColumnId;

                    //set background image

                    webContent.backgroundImage = "https://images.unsplash.com/photo-1505739998589-00fc191ce01d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80";

                    //set height to 500px

                    webContent.height = "400px";

                    webContent.animationName = "";


                    //SETTING MOBILE
                    webContent.heightMobile = "400px";

                    db.WebContents.Add(webContent);

                    //SETTING LAPTOP
                    webContent.heightLaptop = "400px";

                    //SETTING TABLET
                    webContent.heightTablet = "400px";
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }
Esempio n. 4
0
        public WebsiteTemplateProject.Models.WebContent UpsertWebContent(WebsiteTemplateProject.Models.WebContent webContent, GlobalContentDBEntities db)
        {
            using (db)
            {
                if (webContent.Id == default(int))
                {
                    //Default settings when first creating text
                    if (webContent.TextBody != null)
                    {
                        webContent.textMobile = webContent.TextBody;
                        webContent.textTablet = webContent.TextBody;
                        webContent.textLaptop = webContent.TextBody;

                        webContent.textAlign = "center";
                    }

                    //Default settings when first creating background image


                    db.WebContents.Add(webContent);
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                try
                {
                    db.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                    var newException = new FormattedDbEntityValidationException(e);
                    throw newException;
                }


                return(webContent);
            }
        }
        public void CreateImageForLeftMidColumn(int colId)
        {
            Models.WebContent       webContent = new Models.WebContent();
            GlobalContentDBEntities db         = new GlobalContentDBEntities();

            using (db)
            {
                if (webContent.Id == default(int))
                {
                    webContent.ColumnId = colId;

                    //set background image
                    //blue orange
                    webContent.backgroundImage = "https://images.unsplash.com/photo-1561641377-f7456d23aa9b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1226&q=80";
                    webContent.animationName   = "pulse";
                    webContent.HyperLink       = "https://www.google.com/";



                    //Set image height to 1000px
                    webContent.height = "400px";
                    webContent.width  = "400px";



                    //SETTING MOBILE


                    db.WebContents.Add(webContent);
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }
        public void CreateHeroImage(int newColumnId)
        {
            Models.WebContent       webContent = new Models.WebContent();
            GlobalContentDBEntities db         = new GlobalContentDBEntities();

            using (db)
            {
                if (webContent.Id == default(int))
                {
                    webContent.ColumnId = newColumnId;

                    //set background image
                    //blue orange
                    webContent.backgroundImage = "https://images.unsplash.com/photo-1494253109108-2e30c049369b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80";

                    //palm trees
                    //webContent.backgroundImage = "https://images.unsplash.com/photo-1601012608788-21e9c7c0661b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1340&q=80";


                    //Set image height to 1000px
                    webContent.height        = "1000px";
                    webContent.animationName = "";


                    //SETTING MOBILE
                    webContent.heightMobile = "800px";

                    db.WebContents.Add(webContent);
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }
        public void CreateTextForRightColumnTwo(int colId)
        {
            Models.WebContent       webContent = new Models.WebContent();
            GlobalContentDBEntities db         = new GlobalContentDBEntities();

            using (db)
            {
                if (webContent.Id == default(int))
                {
                    webContent.ColumnId = colId;

                    //SETTING Global

                    //Set text
                    webContent.TextBody = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";

                    //Font color
                    webContent.color = "#222222";
                    //Set font size:
                    webContent.fontSize = "18px";
                    //Set font family
                    webContent.fontFamily = "Work Sans";
                    //Set padding
                    webContent.padding = "15px";
                    //Set text align
                    webContent.textAlign     = "center";
                    webContent.paddingMobile = "15px";
                    webContent.paddingTablet = "15px";
                    webContent.paddingLaptop = "15px";


                    //SETTING MOBILE

                    webContent.textMobile      = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
                    webContent.fontSizeMobile  = "18px";
                    webContent.fontFamily      = "Work Sans";
                    webContent.textAlignMobile = "center";

                    //SETTING TABLET

                    webContent.textTablet      = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
                    webContent.fontSizeTablet  = "18px";
                    webContent.fontFamily      = "Work Sans";
                    webContent.textAlignTablet = "center";


                    //SETTING LAPTOP

                    webContent.textLaptop      = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
                    webContent.fontSizeLaptop  = "18px";
                    webContent.fontFamily      = "Work Sans";
                    webContent.textAlignLaptop = "center";

                    db.WebContents.Add(webContent);
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }
        public void CreateHeaderForRightColumnTwo(int midHeaderColId)
        {
            Models.WebContent       webContent = new Models.WebContent();
            GlobalContentDBEntities db         = new GlobalContentDBEntities();

            using (db)
            {
                if (webContent.Id == default(int))
                {
                    webContent.ColumnId = midHeaderColId;

                    //SETTING Global

                    //Set text
                    webContent.TextBody = "Right Header";

                    //Font color
                    webContent.color = "#222222";
                    //Set font size:
                    webContent.fontSize = "25px";
                    //Set font family
                    webContent.fontFamily = "Work Sans";
                    //Set padding
                    webContent.padding = "15px";
                    //Set text align
                    webContent.textAlign = "center";

                    webContent.paddingTablet = "30px";
                    webContent.paddingLaptop = "30px";

                    //Set font wieght
                    webContent.fontWieght = "bold";


                    //SETTING MOBILE

                    webContent.textMobile = "";

                    webContent.fontSizeMobile  = "25px";
                    webContent.fontFamily      = "Work Sans";
                    webContent.textAlignMobile = "center";

                    //SETTING TABLET

                    webContent.textTablet = "Right Header";

                    webContent.fontSizeTablet  = "25px";
                    webContent.fontFamily      = "Work Sans";
                    webContent.textAlignTablet = "center";


                    //SETTING LAPTOP

                    webContent.textLaptop = "Right Header";

                    webContent.fontSizeLaptop  = "25px";
                    webContent.fontFamily      = "Work Sans";
                    webContent.textAlignLaptop = "center";

                    db.WebContents.Add(webContent);
                }
                else
                {
                    db.Entry(webContent).State = EntityState.Modified;
                }

                db.SaveChanges();
            }
        }