Umbraco MVC - How to use Umbraco.Web.Mvc.RenderMvcController?

Thursday, July 10, 2014

I'm using Umbraco 7 to let a member login and update their profile.


I have created the login form using a SurfaceController, which will send the user to "/update-driver", however on this page I cannot create a controller to check if the user is authenticated and fetch their profile details.


I have read that you need to use a RenderController for this type of action in Umbraco? I have created the following controller in my project but I can't get the page to recognise it.


Thanks for any help!


UpdateDriverController:



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Umbraco.Web.Models;

namespace UmbracoCMS.Controllers
{
public class UpdateDriverController : Umbraco.Web.Mvc.RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
// Check if the user is logged in
//if (!User.Identity.IsAuthenticated)
//{
// Send the user to the login page
Redirect("/login");
//}

return base.Index(model);
}
}
}


Template



@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "BootstrapDefaultcshtml.cshtml";
}

@Html.Partial("MemberDriverUpdate", new UmbracoCMS.Models.MemberDriverModel())


Partial View



@using UmbracoCMS.Controllers
@model UmbracoCMS.Models.MemberDriverModel

@Html.ValidationSummary()

@using (Html.BeginUmbracoForm<MemberDriverSurfaceController>("Update"))
{
/*** Form Fields ***/
}






http://ift.tt/1xZqD8o