/// <summary> /// Replaces a user in the storage system asynchronously /// </summary> /// <param name="iUser">User to replace</param> /// <returns>True if the operation was successful</returns> public async Task <Boolean> ReplaceAsync(User iUser) { TableOperation pTOnReplace = TableOperation.Replace(iUser); TableResult pTRtResult = await UsersTable.ExecuteAsync(pTOnReplace); return(pTRtResult.HttpStatusCode == 200 || pTRtResult.HttpStatusCode == 204); }
/// <summary> /// Insert an instance of User into storage asynchronously /// </summary> /// <param name="iUser">The instance of user to insert</param> /// <returns>True if the insert was successful</returns> public async Task <Boolean> InsertUserAsync(User iUser) { Boolean pBlnCreatedTable = await UsersTable.CreateIfNotExistsAsync(); if (pBlnCreatedTable) { return(false); } else { TableOperation pTOnInsert = TableOperation.Insert(iUser); TableResult pTRtResult; try { pTRtResult = await UsersTable.ExecuteAsync(pTOnInsert); switch (pTRtResult.HttpStatusCode) { case 200: case 204: { Boolean pBlnRetVal; pBlnRetVal = CreateDefaultUserProfile(iUser); return(pBlnRetVal); } default: { return(false); } } } catch { return(false); } } }