I'm a little behind on my enums and would appreciate some direction on how to pass an enums from the mvc controller via JsonResult to populate a dropdownlist. I have all my other properties passing just fine. Its only the enum as follows:
Enum
public enum SpeciesType{
Mammal = 1;
Reptile = 2; }
ViewModel
public int Id {get; set;}
public string AnimalName {get; set;}
public DateTime DateOfRecording { get; set; }
public SpeciesType Species { get; set; }
Controller
public JsonResult EditAnimalRecord(int animalId){
var model = new EditViewModel();
var record = (Linq statement in here);
if(record.Id > 104){
model.Id = record.Id;
model.AniamlName = record.Name;
model.DateOfRecording = record.DateEntered;
model.Species = ???(Need to pass enums here) to populate dropdown via JS
}
return Json(model, JsonRequestBehavior.AllowGet)
}