//Edit User Settings in Table Storage public AttendeeRecord EditAttendeeInformation(AttendeeRecord attendeeRecord, string userId) { //Get old record var attendee = GetAttendeeRecord(userId); //assign new values attendee = attendeeRecord; var result = attendeeTable.Execute(TableOperation.InsertOrReplace(attendee)); return(result.Result as AttendeeRecord); }
public AttendeeRecord DecryptÁttendeeRecord(AttendeeRecord attendeeRecord) { if (attendeeRecord.IsEncrypted) { //Is not encrypted yet - we need to work attendeeRecord.Name = DecryptString(attendeeRecord.Name); attendeeRecord.Surname = DecryptString(attendeeRecord.Surname); attendeeRecord.Email = DecryptString(attendeeRecord.Email); attendeeRecord.Birthday = DecryptString(attendeeRecord.Birthday); attendeeRecord.City = DecryptString(attendeeRecord.City); attendeeRecord.ZipCode = DecryptString(attendeeRecord.ZipCode); attendeeRecord.Password = DecryptString(attendeeRecord.Password); attendeeRecord.Username = DecryptString(attendeeRecord.Username); attendeeRecord.IsEncrypted = false; } return(attendeeRecord); }
//Write User to Table Storage public AttendeeRecord CreateAttendeeRecord(UserRegistrationRequest userRegistration) { var attendee = new AttendeeRecord() { PartitionKey = "attendees", Name = userRegistration.Name, Surname = userRegistration.Surname, Email = userRegistration.EmailAddress, Birthday = userRegistration.Birthday, City = userRegistration.City, ZipCode = userRegistration.ZipCode, UserId = userRegistration.UserId, Username = GenerateUsername(userRegistration.Name, userRegistration.Surname), Password = GenerateRandomPassword(), }; //Encrypt Settings attendee = encryptionService.EncryptÁttendeeRecord(attendee); //Write to Table Storage TableResult result = attendeeTable.Execute(TableOperation.InsertOrReplace(attendee)); return(result.Result as AttendeeRecord); }