public void UpdateUser(UserModel user) { using (var context = new MdoDbContext()) { context.Users.AddOrUpdate(new UserAdapter(user).UserEntity); context.SaveChanges(); } }
public void UpdateUser(UserModel user) { userWarehouse.AddOrUpdate(new UserAdapter(user).UserEntity); }
public UserAdapter(UserEntity userEntity) { _userEntity = userEntity; _userModel = CreateModel(); }
private UserModel CreateModel() { if (_userEntity == null) { return null; } IEnumerable<string> roles = new List<string>(); if (_userEntity.Roles != null) { roles = _userEntity.Roles.Select(x => x.Name); } var userModel = new UserModel( _userEntity.Username, _userEntity.Email, _userEntity.Password, _userEntity.Secret, roles); return userModel; }
public UserAdapter(UserModel userModel) { _userModel = userModel; _userEntity = CreateEntity(); }