public static void AddEvent(object sender, EventArgs e) { AddEventData ad = (AddEventData)e; int c = ad.a + ad.b; Console.WriteLine($"触发事件AddEvent, {ad.a}+{ad.b}={c}"); }
public void CallAddEvent() { if (OnAddEvent != null) { AddEventData ad = new AddEventData(); ad.a = 1; ad.b = 2; OnAddEvent(this, ad); } }
public IActionResult AddEventData(AddEventData events) { if (ActiveUser == null) { return(RedirectToAction("Login", "Home")); } if (ModelState.IsValid) { Wedding Wedding = events.TheWedding(); Wedding.Host = ActiveUser; _wContext.Add(Wedding); _wContext.SaveChanges(); return(RedirectToAction("Dashboard", "Wedding")); } return(View("AddEvent")); }