public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { if ((value == null)) { return(null); } TurbineType valueCasted = ((TurbineType)(value)); if ((valueCasted == TurbineType.Pelton)) { return("pelton"); } if ((valueCasted == TurbineType.Francis)) { return("francis"); } if ((valueCasted == TurbineType.Kaplan)) { return("kaplan"); } throw new ArgumentOutOfRangeException("value"); }
private static void CreateTurbineTypes(ApplicationDbContext dbContext) { var typeV = new TurbineType() { Model = "V39/600", Capacity = 600 }; var typeSG = new TurbineType() { Model = "SG 2.1-114", Capacity = 1140 }; var typeN = new TurbineType() { Model = "N43", Capacity = 800 }; var typeE = new TurbineType() { Model = "E-44", Capacity = 900 }; // Insert turbine types into the Database dbContext.TurbineTypes.AddRange(typeV, typeSG, typeN, typeE); dbContext.SaveChanges(); }