1
Answer

Creating a single class

Ramco Ramco

Ramco Ramco

3y
393
1

Hi

  I have Location class & Location View Model . Can the same be done thru Single class.

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; }
    }

Answers (1)