// Constructor public TogetherFormViewModel(Together together) { Together = together; TogetherTypes = CreateTogetherTypes(Together.TogetherType); FeeTypes = CreateFeeTypes(Together.FeeType); }
private static SelectList CreateFeeTypes(FeeTypeEnum SelectedType) { Dictionary <int, string> feeTypes = new Dictionary <int, string>(); foreach (int i in Enum.GetValues(typeof(FeeTypeEnum))) { feeTypes.Add(i, Together.GetStringFromFeeType((FeeTypeEnum)i)); } return(new SelectList(feeTypes, "Key", "Value", (int)SelectedType)); }
public static SelectList CreateTogetherTypesWithAll() { Dictionary <int, string> togetherTypes = new Dictionary <int, string>(); foreach (int i in Enum.GetValues(typeof(TogetherTypeWithAllEnum))) { if (i == 0) { togetherTypes.Add(0, "所有类型"); } else { togetherTypes.Add(i, Together.GetStringFromTogetherType((TogetherTypeEnum)i)); } } return(new SelectList(togetherTypes, "Key", "Value", (int)TogetherTypeWithAllEnum.All)); }
public void Delete(Together together) { db.Post.DeleteAllOnSubmit(together.Posts); db.Attendee.DeleteAllOnSubmit(together.Attendees); db.Together.DeleteOnSubmit(together); }
// 插入/删除 public void Add(Together together) { db.Together.InsertOnSubmit(together); }
partial void DeleteTogether(Together instance);
partial void UpdateTogether(Together instance);
partial void InsertTogether(Together instance);