Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide complete example for ViewModel with CreateVM.cshtml #13752

Closed
michaelmello opened this issue Aug 9, 2019 — with docs.microsoft.com · 10 comments · Fixed by #20064
Closed

provide complete example for ViewModel with CreateVM.cshtml #13752

michaelmello opened this issue Aug 9, 2019 — with docs.microsoft.com · 10 comments · Fixed by #20064
Assignees
Labels
doc-enhancement Pri2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Milestone

Comments

Copy link

michaelmello commented Aug 9, 2019

I noticed the article talks about Create.cshtml and then mentions and links to a CreateVM.cshtml page when discussing View Models. I thought the CreateVM.cshtml link was a typo but there is in fact a page on Github that was created for purposes of the View Model, but no instruction to create it in the tutorial. Just throwing it out there as it may trip up newcomers (where did CreateVM.cshtml come from?).

@Rick-Anderson edit

  • Rename it StudentInputModel
  • Update the Edit page to use StudentInputModel

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added the Source - Docs.ms Docs Customer feedback via GitHub Issue label Aug 9, 2019
@Rick-Anderson
Copy link
Contributor

Thanks for the tip.

Copy link

Agreed. This section was a bit confusing. IMO, the CreateVM section should either be completely fleshed out with running code or removed.

@Rick-Anderson
Copy link
Contributor

@tdykstra replace with InputModel approach with complete code.

@tdykstra
Copy link
Contributor

Agreed that we should do it that way, and this approach should be adopted in later tutorials as well, not just #2 CRUD. This will take some time to fix, so it will wait until higher priority 3.0 updates are done.

@Rick-Anderson
Copy link
Contributor

@tdykstra given that view models are so widely used we should keep this too and maybe provide a GitHub link to the complete code. Automapper is pretty popular.

@tdykstra
Copy link
Contributor

tdykstra commented Aug 19, 2019

In that case, we could switch CRUD to InputModel, keep TryUpdateModel in Update Related Data, and add text explaining the alternatives in both places. If we want to show the ViewModel as yet a 3rd option, could use it on Course pages in Update Related Data, and keep TryUpdateModel only on Instructor pages.

@Rick-Anderson
Copy link
Contributor

Good idea. Before we do, let's run it by the EF folks.

@Rick-Anderson Rick-Anderson added this to the Backlog milestone Aug 21, 2019
Copy link

As a newcomer, this section was extremely frustrating. The use of ViewModels in this context feels incomplete and left me with more questions than answers. Is TryUpdateModel preferred when doing Updates while ViewModels are better for Creation? How would an update with a ViewModel be implemented?

I'm unfamiliar with InputModel, but it would make sense if the tutorial represented all three options on their own instead of having us utilize the TryUpdateModel and then scrap it for a ViewModel just to go back to TryUpdateModel.

@Rick-Anderson
Copy link
Contributor

InputModel is a ViewModel, it's just a VM named InputModel

cc @tdykstra

@Rick-Anderson Rick-Anderson changed the title CreateVM.cshtml provide complete example for ViewModel with CreateVM.cshtml Oct 1, 2019
Copy link

I agree this is confusing. I usually just skip over content like this in tutorials and books. Don't want to waste my time and brain power and get bogged down. I'm just moving on to the update section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Pri2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants