View Shopper Account Details

Create a page that shows various properties of a user account.

Complete the following prerequisites:

At your visual studio solution setup:

  1. Controller action
    UserObject model = null;
    if (Sitecore.Context.User.IsAuthenticated)
    {
    	var user = Sitecore.Context.User;
    	model = user.GetC¬ommerceProfileModel();
    }
    return View(model);
    
  2. View
    @model MVCSite.Models.Generated.UserObject
    
    <h4>Hi @Sitecore.Context.User.LocalName, could we please get some more details from you... </h4>
    
    @using (Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, FormMethod.Post, new { @class = "form-horizontal" }))
    {
    	@Html.Sitecore().FormHandler()
    
    	<div class="control-group">
    		@Html.LabelFor(model => model.TelephoneNumber, new {@class = "control-label"})
    		<div class="controls">
    			@Html.TextBoxFor(model => model.TelephoneNumber, new { placeholder="+1 (613) 123-1234" })
    		</div>
    	</div>
    	<div class="control-group">
    		@Html.LabelFor(model => model.Email, new {@class = "control-label"})
    		<div class="controls">
    			@Html.TextBoxFor(model => model.Email, new { placeholder="me@you.com" })
    		</div>
    	</div>