public void Handle(RemoveLeagueCommand command) { // TODO validate using (var dbContext = new ManagementDataContext()) { League league = dbContext.Leagues.FirstOrDefault(l => l.OrganizerId == command.Id); dbContext.Leagues.Remove(league); dbContext.SaveChanges(); } }
public ActionResult Remove(RemoveLeagueCommand command) { HandleCommand(command, Json("League removed")); return(RedirectToAction("Index")); }