+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Posting Data to Existing Server Database?

Posting Data to Existing Server Database?

4 posts, 0 answered
  1. Michael
    Michael avatar
    3 posts
    Registered:
    17 May 2014
    14 Jul 2014
    Link to this post

    Hi,

    I am fairly new with Sitefinity and currently preforming an internship (Web Development) with my University.

    I am looking for documentation, or guidance on the following:

    • Connecting to an external(by external I'm referring to different server) database that currently holds form data.
    • Ability to post data to that "external" database using the existing Sitefinity web form builder.

    Any help would be greatly appreciated.  

    Thanks,

    Michael 

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    17 Jul 2014
    Link to this post
    Hello Michael,

    Could you please elaborate on what you want exactly to achieve? If you want to export some content items from Sitefinity to the external database, you should implement some extensibility points in your application to which to hook from Sitefinity. You can implement a completely custom solution using services to pass data from and to you external application. If you want more Sitefinity dedicated solution you can create inbound and outbound pipe using the Publishing system described in details in our documentation.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Michael
    Michael avatar
    3 posts
    Registered:
    17 May 2014
    21 Jul 2014 in reply to Nikola Zagorchev
    Link to this post

    Could you please elaborate on what you want exactly to achieve?

    Okay here is the problem.Currently the university uses Javascript to validate the information in the forms there using and upon validation, they use a vb script to post data to a database on campus. 

    What I have resorted to is this so far: 

    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
     
    namespace SitefinityWebApp.Mvc.Models
    {
        public class simpleForm01Model
        {
            public bool IsSubmitted { get; set; }
     
     
            public string Name { get; set; }
     
     
            public string Email { get; set; }
        }
    }
    Above is the model, I am using something very simple  
    using System;
    using System.ComponentModel;
    using System.Linq;
    using System.Web.Mvc;
    using Telerik.Sitefinity.Mvc;
    using SitefinityWebApp.Mvc.Models;
     
    namespace SitefinityWebApp.Mvc.Controllers
    {
        [ControllerToolboxItem(Name = "simpleForm01", Title = "simpleForm01", SectionName = "MvcWidgets")]
        public class simpleForm01Controller : Controller
        {
            public ActionResult Index() {
                var model = new simpleForm01Model();
                return View("Default", model);
            }
     
            [HttpPost]
            public ActionResult Index(simpleForm01Model model) {
                if (ModelState.IsValid) {
                    model.IsSubmitted = true;
                }
     
                return View("Default", model);
            }
        }
    }

    Controller above is simple nothing heavy.
    @using Telerik.Sitefinity.UI.MVC
    @model SitefinityWebApp.Mvc.Models.simpleForm01Model
     
    @if (Model.IsSubmitted) {
        <p>
            Thanks for submitting the form!
        </p>
    } else {
        using (Html.BeginFormSitefinity()) {
             
            <p>
                @Html.EditorForModel()
            </p>
         
            <input type="submit" value="Sumbit Request" />
        }
    }


    This is my view that I have.

    From here, I have no clue how to validate this or send it from here to a script with a connection string to post to an external db. The idea is that once I get a grasp of this simple form that I will be migrating/creating new forms for the university through Sitefinity(MVC). 

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    23 Jul 2014
    Link to this post
    Hi Michael,

    Do you have any endpoints implemented in your other application, through which you can create items? Do you have some kind of RESTful services or other way you can communicate with the other application and post items?
    Another option is to use our alternative publishing system and the RSS feeds and create items based on the feed in your other application. More information could be read here.

    However, based on what you have provided as information and code blocks, I believe that using Services will be the best approach in your scenario, since you want to save only specific content submitted using an MVC widget and not content items from an entire module.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered