First I would start by making your actions more uniform. If you are going to name one "Browsegenre", you would keep the same naming convention for "browsedirector". Change it to "Browsedirector" so they both have a capital B.
Secondly, you don't want to link directors to the Browse action. You want them to link to the Browsedirectors action. Change the actionlink to "Browsedirectors" instead of "Browse".
Next, you need to create a new view for both Browsegenre and Browsedirector. You can do that by right-clicking on each action and choose "Add View". In the Add View panel, you can choose either Genre or Director as your strongly typed model. For the scaffold
template, choose "List".
Best of luck with this. I am heading out for a bit.
I managed to add the views and the genre view works correctly however the directors does not.
When I run and click on the directors name it gives me the following error:
Error 1 'Component2.Models.Director' does not contain a definition for 'Movies' and no extension method 'Movies' accepting a first argument of type 'Component2.Models.Director' could be found (are you missing a using directive or an assembly reference?)
Below is the code that is in the BrowseDirector view:
@model Component2.Models. Director
@{ViewBag.Title ="Browse
Movies";}
<divclass="director">
<h3><em>@Model.Name</em>
Movies</h3>
<ulid="movie-list">
@foreach
(var
movie in
Model.Movies)
{
<li>
<ahref="@Url.Action("Details",new
{ id = movie.MovieId })">
JohnLocke
Contributor
3008 Points
686 Posts
Re: Music Store Tutorial: Store View
Apr 06, 2012 07:26 PM|LINK
First I would start by making your actions more uniform. If you are going to name one "Browsegenre", you would keep the same naming convention for "browsedirector". Change it to "Browsedirector" so they both have a capital B.
Secondly, you don't want to link directors to the Browse action. You want them to link to the Browsedirectors action. Change the actionlink to "Browsedirectors" instead of "Browse".
Next, you need to create a new view for both Browsegenre and Browsedirector. You can do that by right-clicking on each action and choose "Add View". In the Add View panel, you can choose either Genre or Director as your strongly typed model. For the scaffold template, choose "List".
Best of luck with this. I am heading out for a bit.
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 06, 2012 07:40 PM|LINK
Ok thanks for all your help and patience mate. Much appreciated.
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 09, 2012 02:58 PM|LINK
I managed to add the views and the genre view works correctly however the directors does not.
When I run and click on the directors name it gives me the following error:
Error 1 'Component2.Models.Director' does not contain a definition for 'Movies' and no extension method 'Movies' accepting a first argument of type 'Component2.Models.Director' could be found (are you missing a using directive or an assembly reference?)
Below is the code that is in the BrowseDirector view:
@model Component2.Models. Director
@{ViewBag.Title ="Browse Movies";}
<div class="director">
<h3><em>@Model.Name</em> Movies</h3>
<ul id="movie-list">
@foreach (var movie in Model.Movies)
{
<li>
<a href="@Url.Action("Details",new { id = movie.MovieId })">
<img alt="@movie.Title" height="120px" width ="100px" src="@movie.MovieArtUrl" />
<span>@movie.Title</span>
</a>
</li>
}
</ul>
</div>
The underlined and italics bit is where the error is. I dont understand what this error means. Am I missing something elsewhere?
SyedZohebAli...
Member
40 Points
18 Posts
Re: Music Store Tutorial: Store View
Apr 09, 2012 03:26 PM|LINK
uzzy you are missing a using statement of Movies Model. Add this statement @model component2.Models or @model component2.Models.Movies
http://zohebsumair.blogspot.in/
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 09, 2012 03:54 PM|LINK
At the top I have:
@model Component2.Models. Director
I changed the .Director to .Movie and got the same error
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 09, 2012 04:33 PM|LINK
I now get this error:
'Component2.Models.Director' does not declare a navigation property with the name 'Movies'.
I am not too sure where I need to declare the navigation property. Anyone have any idea?
Thanks
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 10, 2012 02:56 PM|LINK
Anyone that can help?
Young Yang -...
All-Star
21111 Points
1817 Posts
Microsoft
Re: Music Store Tutorial: Store View
Apr 12, 2012 10:05 AM|LINK
Hi
Could you show the Director model to us?
Regards
Young Yang
Feedback to us
Develop and promote your apps in Windows Store
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 12, 2012 02:11 PM|LINK
This is the first one I was using:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Component2.Models
{
public class Director
{
public int DirectorId { get; set; }
public string Name { get; set; }
}
}
This is the viewmodel:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Component2.Models;
namespace Component2.ViewModels
{
public class IndexViewModel
{
public List<Genre> Genres { get; set; }
public List<Director> Directors { get; set; }
public IndexViewModel(List<Genre> _genres, List<Director> _directors)
{
Genres = _genres;
Directors = _directors;
}
}
}
uzzy
0 Points
116 Posts
Re: Music Store Tutorial: Store View
Apr 14, 2012 04:15 PM|LINK
Can anyone help?