Hi
I have Location class & Location View Model. Can the same be done through Single class.
I have created 2 classes.
Class - Location
Class - MyViewModel
Instead of creating 2 separate classes, can both the tasks be done in 1 Class?
I created ViewModel since i need 1 record & also IEnumerable list.
public class Location
{
public Location()
{
CreatedOn = DateTime.Now;
LastUpdatedOn = DateTime.Now;
}
[Key]
[Required(ErrorMessage = "Id can not be blank.")]
[Display(Name = "Id")]
public string Id { get; set; }
public string Description { get; set; }
}
//Virtual Model
public class MyViewModel
{
public List<Location> Locations { get; set; }
public Location Location { get; set; }
}
Thanks