public static UserLite Create(UserDTO userDto)
		{
			var userLite = new UserLite();
			Mapper.DynamicMap(userDto, userLite);
			userLite.UserType = UserType.User;
			return userLite;
		}
Exemplo n.º 2
0
 public void Add(UserLite userLite)
 {
     _storageRepository.Get <UserLite>(userLite.Id.ToString()).Add(userLite);
     _storageRepository.Get <UserEmailSearchField>(userLite.Email).Add(new UserEmailSearchField {
         UserId = userLite.Id
     });
 }
Exemplo n.º 3
0
        public static UserLite Create(UserDTO userDto)
        {
            var userLite = new UserLite();

            Mapper.DynamicMap(userDto, userLite);
            userLite.UserType = UserType.User;
            return(userLite);
        }
		public void Update(UserLite user)
		{
			// 4 queries
			var oldUser = _storageRepository.Get<UserLite>(user.Id.ToString()).First();
			_storageRepository.Get<UserLite>(user.Id.ToString()).Update(user,
			                                                                       x => x.Id == user.Id);

			_storageRepository.Get<UserEmailSearchField>(oldUser.Email).Remove(x => x.UserId == user.Id);
			_storageRepository.Get<UserEmailSearchField>(user.Email).Add(new UserEmailSearchField
			                                                                        	{UserId = user.Id});
		}
Exemplo n.º 5
0
        public void Update(UserLite user)
        {
            // 4 queries
            var oldUser = _storageRepository.Get <UserLite>(user.Id.ToString()).First();

            _storageRepository.Get <UserLite>(user.Id.ToString()).Update(user,
                                                                         x => x.Id == user.Id);

            _storageRepository.Get <UserEmailSearchField>(oldUser.Email).Remove(x => x.UserId == user.Id);
            _storageRepository.Get <UserEmailSearchField>(user.Email).Add(new UserEmailSearchField
            {
                UserId = user.Id
            });
        }
		public void Add(UserLite userLite)
		{
			_storageRepository.Get<UserLite>(userLite.Id.ToString()).Add(userLite);
			_storageRepository.Get<UserEmailSearchField>(userLite.Email).Add(new UserEmailSearchField {UserId = userLite.Id});
		}
        private static void AssertRequesterMadeAlive(UserLite requester)
        {
            var updateCommand = Context.Transport.TpQueue.GetMessages<UpdateCommand>().Where(x => x.Dto is RequesterDTO).First();
            updateCommand.ChangedFields.Should(Be.EquivalentTo(new[] {RequesterField.DeleteDate.ToString()}));
            var requesterDto = (RequesterDTO) updateCommand.Dto;
            requesterDto.DeleteDate.Should(Be.Null);

            requesterDto.ID.Should(Be.EqualTo(requester.Id));
        }
 private static void AssertMessageCreatedBy(UserLite user)
 {
     Context.Transport.TpQueue.GetMessages<CreateMessageCommand>().Count().Should(Be.EqualTo(1));
     Context.CreatedMessageDtos.Single().FromID.Should(Be.EqualTo(user.Id), "Message was created on behalf of wrong user");
 }