Ramco Ramco

Ramco Ramco

  • 440
  • 3.4k
  • 529.5k

Creating a single class

Jun 30 2021 10:59 AM

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)