forked from dotnet/AspNetCore.Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dotnet#2 from aspnet/master
Refreshing my fork
- Loading branch information
Showing
344 changed files
with
2,271 additions
and
2,745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 29 additions & 35 deletions
64
...features-api/account-confirmation-and-password-recovery-with-aspnet-identity.md
Large diffs are not rendered by default.
Oops, something went wrong.
102 changes: 50 additions & 52 deletions
102
...ing-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project.md
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+130 KB
...g-aspnet-identity-to-an-empty-or-existing-web-forms-project/_static/image15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+141 KB
...g-aspnet-identity-to-an-empty-or-existing-web-forms-project/_static/image16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+59.5 KB
...g-aspnet-identity-to-an-empty-or-existing-web-forms-project/_static/image17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 17 additions & 30 deletions
47
aspnet/identity/overview/getting-started/introduction-to-aspnet-identity.md
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
aspnet/identity/overview/getting-started/introduction-to-aspnet-identity/samples/sample6.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[HttpPost] | ||
[AllowAnonymous] | ||
[ValidateAntiForgeryToken] | ||
public async Task<ActionResult> Register(RegisterViewModel model) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; | ||
var result = await UserManager.CreateAsync(user, model.Password); | ||
if (result.Succeeded) | ||
{ | ||
await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false); | ||
|
||
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771 | ||
// Send an email with this link | ||
// string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); | ||
// var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); | ||
// await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); | ||
|
||
return RedirectToAction("Index", "Home"); | ||
} | ||
AddErrors(result); | ||
} | ||
|
||
// If we got this far, something failed, redisplay form | ||
return View(model); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+109 KB
(630%)
...rted/database-first-development/creating-the-web-application/_static/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-15.5 KB
...ted/database-first-development/creating-the-web-application/_static/image10.png
Binary file not shown.
Binary file modified
BIN
+51.7 KB
(600%)
...ted/database-first-development/creating-the-web-application/_static/image11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-9.24 KB
...ted/database-first-development/creating-the-web-application/_static/image12.png
Binary file not shown.
Binary file removed
BIN
-20.2 KB
...rted/database-first-development/creating-the-web-application/_static/image2.png
Binary file not shown.
Binary file modified
BIN
+40 KB
(250%)
...rted/database-first-development/creating-the-web-application/_static/image3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-38.3 KB
...rted/database-first-development/creating-the-web-application/_static/image4.png
Binary file not shown.
Binary file removed
BIN
-13.8 KB
...rted/database-first-development/creating-the-web-application/_static/image5.png
Binary file not shown.
Binary file removed
BIN
-13.1 KB
...rted/database-first-development/creating-the-web-application/_static/image6.png
Binary file not shown.
Binary file removed
BIN
-32.3 KB
...rted/database-first-development/creating-the-web-application/_static/image7.png
Binary file not shown.
Binary file modified
BIN
+65 KB
(520%)
...rted/database-first-development/creating-the-web-application/_static/image8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-23.8 KB
...rted/database-first-development/creating-the-web-application/_static/image9.png
Binary file not shown.
48 changes: 33 additions & 15 deletions
48
...t/mvc/overview/getting-started/database-first-development/customizing-a-view.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,55 @@ | ||
--- | ||
uid: mvc/overview/getting-started/database-first-development/customizing-a-view | ||
title: "EF Database First with ASP.NET MVC: Customizing a View | Microsoft Docs" | ||
title: "Tutorial: Customize view for EF Database First with ASP.NET MVC app" | ||
description: "This tutorial focuses on changing the automatically-generated views to enhance the presentation." | ||
author: Rick-Anderson | ||
description: "Using MVC, Entity Framework, and ASP.NET Scaffolding, you can create a web application that provides an interface to an existing database. This tutorial seri..." | ||
ms.author: riande | ||
ms.date: 10/01/2014 | ||
ms.date: 01/24/2019 | ||
ms.topic: tutorial | ||
ms.assetid: 269380ff-d7e1-4035-8ad1-fe1316a25f76 | ||
msc.legacyurl: /mvc/overview/getting-started/database-first-development/customizing-a-view | ||
msc.type: authoredcontent | ||
--- | ||
EF Database First with ASP.NET MVC: Customizing a View | ||
==================== | ||
by [Tom FitzMacken](https://github.com/tfitzmac) | ||
|
||
> Using MVC, Entity Framework, and ASP.NET Scaffolding, you can create a web application that provides an interface to an existing database. This tutorial series shows you how to automatically generate code that enables users to display, edit, create, and delete data that resides in a database table. The generated code corresponds to the columns in the database table. | ||
> | ||
> This part of the series focuses on changing the automatically-generated views to enhance the presentation. | ||
# Tutorial: Customize view for EF Database First with ASP.NET MVC app | ||
|
||
Using MVC, Entity Framework, and ASP.NET Scaffolding, you can create a web application that provides an interface to an existing database. This tutorial series shows you how to automatically generate code that enables users to display, edit, create, and delete data that resides in a database table. The generated code corresponds to the columns in the database table. | ||
|
||
## Add enrolled courses to student details | ||
This tutorial focuses on changing the automatically-generated views to enhance the presentation. | ||
|
||
In this tutorial, you: | ||
|
||
> [!div class="checklist"] | ||
> * Add courses to the student detail page | ||
> * Confirm that the courses are added to the page | ||
## Prerequisites | ||
|
||
* [Change the database](changing-the-database.md) | ||
|
||
## Add courses to student detail | ||
|
||
The generated code provides a good starting point for your application but it does not necessarily provide all of the functionality that you need in your application. You can customize the code to meet the particular requirements of your application. Currently, your application does not display the enrolled courses for the selected student. In this section, you will add the enrolled courses for each student to the **Details** view for the student. | ||
|
||
Open **Students/Details.cshtml**, and below the last </dl> tab, but before the closing </div> tag, add the following code. | ||
Open **Views** > **Students** > *Details.cshtml*. Below the last </dl> tag, but before the closing </div> tag, add the following code. | ||
|
||
[!code-cshtml[Main](customizing-a-view/samples/sample1.cshtml)] | ||
|
||
This code creates a table that displays a row for each record in the Enrollment table for the selected student. The **Display** method renders HTML for the object (modelItem) that represents the expression. You use the Display method (rather than simply embedding the property value in the code) to make sure the value is formatted correctly based on its type and the template for that type. In this example, each expression returns a single property from the current record in the loop, and the values are primitive types which are rendered as text. | ||
|
||
Browse to the Students/Index view again and select **Details** for one of the students. You will see the enrolled courses have been included in the view. | ||
## Confirm courses are added | ||
|
||
Run the solution. Click **List of students** and select **Details** for one of the students. You will see the enrolled courses have been included in the view. | ||
|
||
![student with enrollment](customizing-a-view/_static/image1.png) | ||
|
||
> [!div class="step-by-step"] | ||
> [Previous](changing-the-database.md) | ||
> [Next](enhancing-data-validation.md) | ||
## Next steps | ||
In this tutorial, you: | ||
|
||
> [!div class="checklist"] | ||
> * Added courses to the student detail page | ||
> * Confirmed that the courses are added to the page | ||
Advance to the next tutorial to learn how to add data annotations to specify validation requirements and display formatting. | ||
> [!div class="nextstepaction"] | ||
> [Enhance data validation](enhancing-data-validation.md) |
Binary file modified
BIN
+18.5 KB
(250%)
...etting-started/database-first-development/customizing-a-view/_static/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.