Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

ViewResult and PartialViewResult classes are inconsistent #4813

Closed
ivaylokenov opened this issue Jun 5, 2016 · 2 comments
Closed

ViewResult and PartialViewResult classes are inconsistent #4813

ivaylokenov opened this issue Jun 5, 2016 · 2 comments
Assignees
Labels
3 - Done bug up-for-grabs Members of our awesome commnity can handle this issue

Comments

@ivaylokenov
Copy link
Contributor

Currently, to get the model from a ViewResult, you have direct property .Model. On the other hand PartialViewResult does not have such property and to access the model, you need to write .ViewData?.Model. I believe both classes should be consistent in their public properties.

@dougbu
Copy link
Member

dougbu commented Jun 6, 2016

ViewResult and PartialViewResult in MVC 5 both have a Model property because they subclass ViewResultBase and the property lives there.

@Eilon Eilon added this to the 1.0.1 milestone Jun 6, 2016
@Eilon Eilon added bug 1 - Ready up-for-grabs Members of our awesome commnity can handle this issue labels Jun 6, 2016
@Eilon
Copy link
Member

Eilon commented Jun 6, 2016

Yeah we could definitely add some more convenience properties. Should look at ViewComponentViewResult or whatever it's called as well.

cjqian pushed a commit that referenced this issue Jun 23, 2016
cjqian pushed a commit that referenced this issue Jun 24, 2016
cjqian pushed a commit that referenced this issue Jun 28, 2016
* Added consistent model property/tests to ViewResult, PartialViewResult, ViewComponentResult. This resolves #4813.

* Removed unnecessary model asserts

* Removed redundant model checking
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - Done bug up-for-grabs Members of our awesome commnity can handle this issue
Projects
None yet
Development

No branches or pull requests

4 participants