public ActionResult Edit([Bind(Include = "JumbotronID,Title,Paragraph,ImagePath")] Jumbotron jumbotron)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jumbotron).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jumbotron));
 }
Ejemplo n.º 2
0
        public void Should_Remove_Jumbotron_Tag_From_Markup()
        {
            // Arrange
            string    markup    = "Here is some ===Heading 1=== markup \n[[[jumbotron=\n==Welcome==\n==This the subheading==]]]";
            Jumbotron jumbotron = new Jumbotron(_container.MarkupConverter);

            // Act
            string actualMarkup = jumbotron.BeforeParse(markup);

            // Assert
            Assert.That(actualMarkup, Is.EqualTo("Here is some ===Heading 1=== markup \n"));
        }
        // GET: Jumbotron/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Jumbotron jumbotron = db.Jumbotrons.Find(id);

            if (jumbotron == null)
            {
                return(HttpNotFound());
            }
            return(View(jumbotron));
        }
Ejemplo n.º 4
0
        public void Should_Parse_And_Fill_PreContainerHtml()
        {
            // Arrange
            string markup       = "Here is some ===Heading 1=== markup \n[[[jumbotron==Welcome=\n==This the subheading==]]]";
            string expectedHtml = Jumbotron.HTMLTEMPLATE.Replace("${inner}", "<p><h1>Welcome</h1><h2>This the subheading</h2></p>");

            Jumbotron jumbotron = new Jumbotron(_container.MarkupConverter);

            // Act
            jumbotron.BeforeParse(markup);
            string actualHtml = jumbotron.GetPreContainerHtml();

            // Assert
            Assert.That(actualHtml, Is.EqualTo(expectedHtml));
        }
Ejemplo n.º 5
0
        public ActionResult HomepageSettings(FormCollection fc)
        {
            if (!CheckLogin())
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (string.IsNullOrEmpty(fc["inputCapital"]) | string.IsNullOrEmpty(fc["inputDescribe"]) | string.IsNullOrEmpty(fc["buttonText"]) | string.IsNullOrEmpty(fc["buttonUrl"]))
            {
                //任何一项为空
                return(View());
            }
            Jumbotron jb = new Jumbotron()
            {
                Capital            = fc["inputCapital"],
                Describe           = fc["inputDescribe"],
                DownloadButtonText = fc["buttonText"],
                DownloadUrl        = fc["buttonUrl"]
            };

            db.Jumbotrons.Add(jb);
            db.SaveChanges();
            return(View());
        }