/// <summary> /// Checks if a user is in the store, if it is, process is bypassed. Otherwhise /// </summary> /// <param name="id"></param> /// <returns></returns> /// <remarks>Will add much more data later on from social request</remarks> public bool ValidateUser(BasicUserData socialData) { using (var session = SessionProvider.OpenSession()) { var person = session.Query<Person>().Where(p => p.SocialId.Equals(socialData.UserId.ToString())).FirstOrDefault(); //If there is no match store new record if (person.IsNull()) { person = new Person { SocialId = socialData.UserId, FirstName = socialData.UserName.Split(' ')[0], LastName = socialData.UserName.Split(' ')[1], PictureURI = socialData.PictureUrl }; session.Store(person); session.SaveChanges(); } return true; } }
public void ExampleRoleCheck() { var p = new Person(); var isInrole = p.IsPersonInRole(r => r.Name.Equals("Member", StringComparison.InvariantCultureIgnoreCase)); }