本文整理汇总了C#中UserModel.CopyFrom方法的典型用法代码示例。如果您正苦于以下问题:C# UserModel.CopyFrom方法的具体用法?C# UserModel.CopyFrom怎么用?C# UserModel.CopyFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel.CopyFrom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateUserAccessChangeEventModel
public UserModel GenerateUserAccessChangeEventModel(int id)
{
UserModel model = new UserModel();
User user = UserRepository.Items.SingleOrDefault(t => t.Id == id);
if (user == null)
{
throw new EntityNotFoundException("User");
}
model.CopyFrom(user);
return model;
}
示例2: GenerateUserProfileViewModel
public UserModel GenerateUserProfileViewModel(EducationSecurityPrincipal user)
{
if (user == null)
{
throw new ArgumentNullException("user");
}
UserModel viewModel = new UserModel();
User userEntity = user.Identity.UserEntity;
viewModel.CopyFrom(userEntity);
return viewModel;
}
示例3: GivenId_WhenGenerateUserLoginEventModel_ThenExpectedModelReturned
public void GivenId_WhenGenerateUserLoginEventModel_ThenExpectedModelReturned()
{
var user = Data.Users[0];
UserModel expected = new UserModel();
expected.CopyFrom(user);
UserModel actual = Target.GenerateUserLoginEventModel(user.Id);
Assert.AreEqual(expected.Id, actual.Id);
Assert.AreEqual(expected.FirstName, actual.FirstName);
Assert.AreEqual(expected.LastName, actual.LastName);
Assert.AreEqual(expected.DisplayName, actual.DisplayName);
}