2014-01-28 19:41:21 +11:00
using System ;
using System.Collections.Generic ;
2013-08-28 17:52:06 +02:00
using System.ComponentModel.DataAnnotations ;
using System.Linq ;
2014-01-28 19:41:21 +11:00
using System.Web ;
2013-08-28 17:52:06 +02:00
using umbraco.cms.businesslogic.member ;
2014-01-28 19:41:21 +11:00
using Umbraco.Core ;
using Umbraco.Web.Security ;
2013-08-28 17:52:06 +02:00
namespace Umbraco.Web.Models
{
public class ProfileModel
{
2014-01-28 19:41:21 +11:00
public static ProfileModel CreateModel ( )
2013-08-28 17:52:06 +02:00
{
2014-01-28 19:41:21 +11:00
var model = new ProfileModel ( false ) ;
return model ;
}
2013-08-28 17:52:06 +02:00
2014-01-28 19:41:21 +11:00
private ProfileModel ( bool doLookup )
{
MemberProperties = new List < UmbracoProperty > ( ) ;
if ( doLookup )
{
var helper = new MembershipHelper ( ApplicationContext . Current , new HttpContextWrapper ( HttpContext . Current ) ) ;
var model = helper . CreateProfileModel ( ) ;
MemberProperties = model . MemberProperties ;
}
}
2013-08-28 17:52:06 +02:00
2014-01-28 19:41:21 +11:00
[Obsolete("Do not use this ctor as it will perform business logic lookups. Use the MembershipHelper.CreateProfileModel or the static ProfileModel.CreateModel() to create an empty model.")]
public ProfileModel ( )
: this ( true )
{
2013-08-28 17:52:06 +02:00
}
[Required]
[RegularExpression(@"[a-z0-9!#$%&'*+/=?^_`{|}~-] + ( ? : \ . [ a - z0 - 9 ! # $ % & ' * + / = ? ^ _ ` { | } ~ - ] + ) * @ ( ? : [ a - z0 - 9 ] ( ? : [ a - z0 - 9 - ] * [ a - z0 - 9 ] ) ? \ . ) + [ a - z0 - 9 ] ( ? : [ a - z0 - 9 - ] * [ a - z0 - 9 ] ) ? ",
ErrorMessage = "Please enter a valid e-mail address" ) ]
public string Email { get ; set ; }
public string Name { get ; set ; }
public string MemberTypeAlias { get ; set ; }
public List < UmbracoProperty > MemberProperties { get ; set ; }
}
}