Azure Serverless Computing Cookbook
上QQ阅读APP看书,第一时间看更新

Accepting the new email parameter in the RegisterUser function

Perform the following steps:

  1. Navigate to the RegisterUser function, in the run.csx file and add a new string variable that accepts a new input parameter, named email, from the request object, as follows. Also, note that we are serializing the UserProfile object and storing the JSON content to the Queue message:
string firstname=null,lastname = null, email = null;
...
...
string email = inputJson.email;
...
...
UserProfile objUserProfile = new UserProfile(firstname,lastname,email);
...
...
await
NotificationQueueItem.AddAsync(JsonConvert.SerializeObject(objUserProfile));

  1. Update the following highlighted code to the UserProfile class and click on the Save button to save the changes:
        public class UserProfile : TableEntity
{
public UserProfile(string firstname,string lastname, string
profilePicUrl,string email)
{
....
....
this.ProfilePicUrl = profilePicUrl;
this.Email = email;
}
....
....
public string ProfilePicUrl {get; set;}
public string Email { get; set; }
}