Click here to Skip to main content
16,020,840 members
Please Sign up or sign in to vote.
1.08/5 (4 votes)
See more:
Hello programmers, please i dèsperately need a help in coding the controller of a particular model in my asp.net applicatiön.
I am using Razor view and not aspx.
This is exactly what i want to achieve. . . . I am building a blog but want the user to keep track of the number of blog he has so this is how my blog and track model look like:
C#
public class Blog
{ public int Id {get; set;}
public string Title {get; set;}
public string Message {get; set;}
}

public class Track {get; set;}
{
public Track(){
this.blogNumber = new hashset<blog>();
}
public int Id {get; set;}
public virtual ICollection<blog> blogsNumber {get; set;}
}


but i don't know how to code the controller so that in my view it will display the numbers of blog of the particular user.
Posted
Updated 25-Apr-15 0:40am
v3
Comments
[no name] 25-Apr-15 13:17pm    
Hai,are you a beginner then study mvc tutorial..

1 solution

 
Share this answer
 
Comments
[no name] 4-May-15 14:58pm    
Hello, please i want to edit my profile. With linq i can query the database to retrieve the profile details but when i click on edit, it simply gives an error. The url is displaying "profile/edit/1" but its like that pattern doesn't work since in my index i changed it to not return a list. Below, is what i have tried:
public ActionResult Index()
{
var spc = (from d in db.profiles.ToList()
where d.username == User.identity.Name
select new profile()
{name = d.name,
// other properties
});
return view(db.profile.ToList());
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900