Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, i am creating a web application using mvc5 that has a profile page, galleries, and youtube page.
Now, i have manage to construct that of the profile page by customizing the "IdentityUser.cs" to include additional properties but i am stuck when it comes to gallery aspect. I have the class built up quite alright but i don't know how to go about setting it up to work the way i want it to.
I want each user to have a gallery page so i'm thinking should i still add this as a property in "IdentityUser.cs" or should i set it as a foreignkey to profile.cs and if so i am having hard time understanding relationships between entities. Please, even if you want to give me a link to boost my understanding, kindly help me in constructing the kind of relationship i have explained that i need. Please. I am new to c# and its good in web apps.

Public class Galleries{
public int Id {get;set;}
public string Picture {get;set;}
public string Name {get;set}
public string Description {get;set;}
}
Posted

 
Share this answer
 
Comments
[no name] 1-Apr-15 13:13pm    
In visual studio 2012, the default web app that is built for you, where will you reference your entity assuming you want each user to have a gallery page. Are you going to set one-to-many relationship with the registration model or the login model?
If you don't understand my question, please bear with me because my type understand more from example and no example online are specific to the target.

Please, if its possible i can give you my email, please and please help me develop a small application. Its simple to you: add a galleries entity and add some properties to the registration page and when login, i will be able to edit my profile and view my galleries. Please help me out. I can give you my email to send it as an attachment. I will be very greatful. This has taken me 2month and can't still understand it. Please.
John C Rayan 2-Apr-15 4:52am    
Give me your email.
[no name] 12-May-15 14:21pm    
Katyagorbachova@gmail.com
sorry for late response.
To set up relationship between entiites.You have to use foreign key.

.A foreign key is an attribute that completes a relationship by identifying the parent entity.
 
Share this answer
 
Comments
[no name] 1-Apr-15 13:14pm    
One to one don't have a foreign key. Just virtual
[no name] 4-May-15 14:53pm    
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