Exemplo n.º 1
0
 public GetUsersOutput UpdateUsers(UpdateUsersInput userDataObjects)
 {
     return _userServiceImp.UpdateUsers(userDataObjects);
 }
Exemplo n.º 2
0
        public GetUsersOutput UpdateUsers(UpdateUsersInput input)
        {
            var userDtos = this.PerformUpdateObjects<List<UserDto>, UserDto, User>(input.Users, _userRepository,
               userDto => userDto.Id.ToString(),
               (u, userDto) =>
               {
                   if (!string.IsNullOrEmpty(userDto.Contact))
                       u.Contact = userDto.Contact;
                   if (!string.IsNullOrEmpty(userDto.PhoneNumber))
                       u.PhoneNumber = userDto.PhoneNumber;
                   if (userDto.ContactAddress != null)
                   {
                       if (!string.IsNullOrEmpty(userDto.ContactAddress.City))
                           u.ContactAddress.City = userDto.ContactAddress.City;
                       if (!string.IsNullOrEmpty(userDto.ContactAddress.Country))
                           u.ContactAddress.Country = userDto.ContactAddress.Country;
                       if (!string.IsNullOrEmpty(userDto.ContactAddress.State))
                           u.ContactAddress.State = userDto.ContactAddress.State;
                       if (!string.IsNullOrEmpty(userDto.ContactAddress.Street))
                           u.ContactAddress.Street = userDto.ContactAddress.Street;
                       if (!string.IsNullOrEmpty(userDto.ContactAddress.Zip))
                           u.ContactAddress.Zip = userDto.ContactAddress.Zip;
                   }
                   if (userDto.DeliveryAddress != null)
                   {
                       if (!string.IsNullOrEmpty(userDto.DeliveryAddress.City))
                           u.DeliveryAddress.City = userDto.DeliveryAddress.City;
                       if (!string.IsNullOrEmpty(userDto.DeliveryAddress.Country))
                           u.DeliveryAddress.Country = userDto.DeliveryAddress.Country;
                       if (!string.IsNullOrEmpty(userDto.DeliveryAddress.State))
                           u.DeliveryAddress.State = userDto.DeliveryAddress.State;
                       if (!string.IsNullOrEmpty(userDto.DeliveryAddress.Street))
                           u.DeliveryAddress.Street = userDto.DeliveryAddress.Street;
                       if (!string.IsNullOrEmpty(userDto.DeliveryAddress.Zip))
                           u.DeliveryAddress.Zip = userDto.DeliveryAddress.Zip;
                   }
                   if (userDto.LastLogonDate != null)
                       u.LastLogonDate = userDto.LastLogonDate;
                   if (userDto.RegisteredDate != null)
                       u.CreationTime = userDto.RegisteredDate.Value;
                   if (!string.IsNullOrEmpty(userDto.Email))
                       u.Email = userDto.Email;

                   if (userDto.IsDisabled != null)
                   {
                       if (userDto.IsDisabled.Value)
                           u.Disable();
                       else
                           u.Enable();
                   }

                   if (!string.IsNullOrEmpty(userDto.Password))
                       u.Password = userDto.Password;
               });

            return new GetUsersOutput
            {
                Users = userDtos
            };
        }