public async Task <bool> Replicate(UserDetailDocument document) { var filter = Builders <UserDocumentMdo> .Filter.Where(s => s.UserId == document.UserId); var update = Builders <UserDocumentMdo> .Update .Set(s => s.FirstName, document.FirstName) .Set(s => s.MiddleName, document.MiddleName) .Set(s => s.LastName, document.LastName) .Set(s => s.BirthDate, document.BirthDate) .Set(s => s.IsDeleted, document.IsDeleted) .Set(s => s.PhoneNumber, document.PhoneNumber) .Set(s => s.UserId, document.UserId) .Set(s => s.PersonalDetails, new PersonalDetailDocumentMdo { Address = document.Address, City = document.City, State = document.State, Pincode = document.Pincode, Country = document.Country, Qualification = document.Qualification, JobTitle = document.JobTitle, Photo = document.Photo }); var result = await this.UserDocumentCollection.UpdateOneAsync(filter, update, new UpdateOptions { IsUpsert = true }); return(result.IsAcknowledged); }
public static UserDetailViewModel ToUserDetailViewModel(this UserDetailDocument userModel) { return(userModel != null ? new UserDetailViewModel { UserId = userModel.UserId, FirstName = userModel.FirstName, MiddleName = userModel.MiddleName, LastName = userModel.LastName, PhoneNumber = userModel.PhoneNumber, BirthDate = userModel.BirthDate, UserType = userModel.UserType, Email = userModel.Email, Address = userModel.Address, City = userModel.City, State = userModel.State, Pincode = userModel.Pincode, Country = userModel.Country, Qualification = userModel.Qualification, JobTitle = userModel.JobTitle, Photo = userModel.Photo } : null); }
public async Task <bool> Replicate(UserDetailDocument user) { return(await this.userRepository.Replicate(user)); }