public ActionResult Statistic(long id) { var detail = new MatchDetailDao().ListMatchDetailViewModel(id); var match = new MatchDao().GetByID(id);; ViewBag.Match = match; return(View(detail)); }
public ActionResult Delete(long id) { MatchDao matchDao = new MatchDao(); MatchDetailDao detailDao = new MatchDetailDao(); Match match = matchDao.GetByID(id); bool res = matchDao.Delete(id); bool resDetail = detailDao.DeleteAll(match.ID); return(RedirectToAction("Index")); }
//Display the Match and its detail public ActionResult Detail(long id) { var match = new MatchDao().GetViewModelByID(id); var listDetail = new MatchDetailDao().ListMatchDetailViewModel(id); var recentMatches = new MatchDao().ListRecentMatch(10); ViewBag.ListDetail = listDetail; ViewBag.RecentMatches = recentMatches; return(View(match)); }
public JsonResult AddRow(string row) { try { var json = new JavaScriptSerializer().Deserialize <MatchDetail>(row); MatchDetail detail = new MatchDetail(); detail.MatchID = json.MatchID; detail.ClubID = json.ClubID; detail.PlayerID = json.PlayerID; detail.Goal = json.Goal == null ? 0 : json.Goal; detail.Assist = json.Assist == null ? 0 : json.Assist; detail.RedCard = json.RedCard == null ? 0 : json.RedCard; detail.YellowCard = json.YellowCard == null ? 0 : json.YellowCard; detail.Status = true; var dao = new MatchDetailDao(); if (dao.CheckExistRow(detail.MatchID, detail.ClubID, detail.PlayerID) == false) { dao.Insert(detail); return(Json(new { status = true })); } else { return(Json(new { status = false })); } } catch (Exception ex) { return(Json(new { status = false })); } }