//common lib public bool Insert(season_club entity) { try { //thêm CLB vào mùa giải db.season_club.Add(entity); //thêm CLB vào bảng xếp hạng var info_rank = new rank(); info_rank.footballClub_id = entity.idx_fooballClub_id; info_rank.season_id = entity.idx_season_id; info_rank.win_match_guest = 0; info_rank.win_match = 0; info_rank.lose_match = 0; info_rank.draw_match = 0; info_rank.win_score = 0; info_rank.lose_score = 0; new rank_dao().Insert(info_rank); db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Update(season_club entity) { try { var info = db.season_club.Find(entity.id); info.idx_fooballClub_id = entity.idx_fooballClub_id; info.idx_season_id = entity.idx_season_id; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public ActionResult Create(season_club seasonClub) { if (ModelState.IsValid) { var dao = new season_club_dao(); bool result = dao.Insert(seasonClub); if (result) { SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success"); return(RedirectToAction("Index", "Season", new { season_id = seasonClub.idx_season_id })); } else { ModelState.AddModelError("", StaticResources.Resources.InsertSeasonClubFailed); } } SetListClub(seasonClub.idx_fooballClub_id); SetListSeason(seasonClub.idx_season_id); return(View()); }