You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Open a command prompt and run the following code. This creates a new Razor Pages application in ASP.NET Core, using Individual account auth, and places it in an output folder named *QuoteOfTheDay*.
30
30
@@ -89,12 +89,6 @@ In this tutorial, you'll use a variant feature flag to manage experiences for di
89
89
90
90
## Use the variant feature flag
91
91
92
-
1. In *QuoteOfTheDay* > *Pages* > *Shared* > *_Layout.cshtml*, under where `QuoteOfTheDay.styles.css` is added, add the following reference to the font-awesome CSS library.
1. Open *QuoteOfTheDay* > *Pages* > *Index.cshtml.cs* and replace the content with the following code.
99
93
100
94
```csharp
@@ -158,7 +152,13 @@ In this tutorial, you'll use a variant feature flag to manage experiences for di
158
152
}
159
153
```
160
154
161
-
This `PageModel` picks a random quote, uses `GetVariantAsync` to get the variant for the current user, and sets a variable called "GreetingMessage" to the variant's value. The `PageModel` also handles likes, which are sent as post requests.
155
+
You call `GetVariantAsync` to retrieve the variant of the *Greeting* feature flag for the current user and assign its value to the `GreetingMessage` property of the page model. This page model also includes a handler for POST requests, which are triggered when users like the quote and click the heart button.
156
+
157
+
1. In *QuoteOfTheDay* > *Pages* > *Shared* > *_Layout.cshtml*, under where `QuoteOfTheDay.styles.css` is added, add the following reference to the font-awesome CSS library.
1. Open *index.cshtml* and replace its content with the following code.
164
164
@@ -265,7 +265,7 @@ In this tutorial, you'll use a variant feature flag to manage experiences for di
265
265
</script>
266
266
```
267
267
268
-
This code corresponds to the UI to show the QuoteOfTheDay and handle using the heart action on a quote. It uses the previously mentioned `Model.GreetingMessage` value to show different things to different users, depending on their variant.
268
+
This code displays the UI of the *Quote of the Day* application and shows the `GreetingMessage` from the page model. The JavaScript handler `heartClicked` is triggered when the heart button is clicked.
269
269
270
270
### Build and run the app
271
271
@@ -289,21 +289,20 @@ In this tutorial, you'll use a variant feature flag to manage experiences for di
289
289
290
290
> [!NOTE]
291
291
> It's important for the purpose of this tutorial to use these names exactly. As long as the feature has been configured as expected, the two users should see different variants.
292
-
@
292
+
293
293
1. Select **Login** at the top right to sign in as [email protected].
294
294
295
295
:::image type="content" source="media/use-variant-feature-flags-aspnet-core/login.png" alt-text="Screenshot of the Quote of the day app, showing **Login**.":::
296
296
297
-
1. Once logged in, you should see that [email protected] sees the long message when viewing the app, and userb@contoso.com sees the simple message.
297
+
1. Once logged in, you see a long greeting message for **usera@contoso.com**
298
298
299
-
:::image type="content" source="media/use-variant-feature-flags-aspnet-core/special-message.png" alt-text="Screenshot of the Quote of the day app, showing a special message for the user.":::
299
+
:::image type="content" source="media/use-variant-feature-flags-aspnet-core/long-variant.png" alt-text="Screenshot of the Quote of the day app, showing a long message for the user.":::
300
300
301
-
## Next steps
301
+
1. Click *Logout* and login as **[email protected]**, you see the simple greeting message.
302
302
303
-
To learn more about the experimentation concepts, refer to the following document.
303
+
:::image type="content" source="media/use-variant-feature-flags-aspnet-core/simple-variant.png" alt-text="Screenshot of the Quote of the day app, showing a simple message for the user.":::
304
304
305
-
> [!div class="nextstepaction"]
306
-
> [Experimentation](./concept-experimentation.md)
305
+
## Next steps
307
306
308
307
For the full feature rundown of the .NET feature management library, refer to the following document.
0 commit comments