ViewModel for the Profile membership user profile
Ejemplo n.º 1
0
        public static ProfileViewModel Create(IRepository repository, IFirmService firmService, string userId, string site)
        {
            Check.Require(repository != null, "Repository must be supplied");
            Check.Require(firmService != null, "firmService is required.");

            var user = repository.OfType<User>().Queryable.Where(a => a.LoweredUserName == userId.ToLower()).FirstOrDefault();

            Check.Require(user != null, "user is required.");

            var person = user.Person;

            Check.Require(person != null, "person is required.");

            var seminarPerson = person.GetLatestRegistration(site);

            var viewModel = new ProfileViewModel()
                                {
                                    Firm = seminarPerson.Firm,
                                    SeminarPerson = seminarPerson,
                                    Person = person
                                };

            return viewModel;
        }