public class Attendance
{
[Key][Column(Order = 1)]public int GigId { get; set; }[Key][Column(Order = 2)]public string AttendeeId { get; set; }public Gigs gig { get; set; }public ApplicationUser Attendee { get; set; }
}
in above Model: we need GigId and AttendeeId .
we are defined in list
but why create object of same class:
public Gigs gig { get; set; }
public ApplicationUser Attendee { get; set; }
this is ViewModel or Model ???


Saravanan VRank #1,695 · 899 reputationPosted Jun 13, 2017, 7:21 AM EDT
First, you need to understand the purpose of ViewModel and Model classes.
The purpose of a ViewModel is for the view to have an object to render data in the Html page.
Your viewmodel( or presentation model) is specific to the view and you should not have the viewmodel referenced in any other layers of project except the presentation/Web layer.
I found below article which also explains the same.
http://www.c-sharpcorner.com/UploadFile/abhikumarvatsa/what-is-model-and-viewmodel-in-mvc-pattern/
Manikandan MurugesanRank #300 · 8.4K reputationPosted Jun 12, 2017, 10:12 PM EDT
Priyansh BhaliyaRank #4,191 · 359 reputationPosted Jun 12, 2017, 10:24 PM EDT
Rajkiran SwainRank #165 · 14.4K reputationPosted Jun 12, 2017, 11:16 PM EDT