Posting Data to Existing Server Database?

Posted by Community Admin on 03-Aug-2018 14:15

Posting Data to Existing Server Database?

All Replies

Posted by Community Admin on 14-Jul-2014 00:00

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 

Posted by Community Admin on 17-Jul-2014 00:00

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
 

Posted by Community Admin on 21-Jul-2014 00:00

[quote]Could you please elaborate on what you want exactly to achieve?[/quote]

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). 

Posted by Community Admin on 23-Jul-2014 00:00

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
 

This thread is closed