//common lib public bool Insert(football_club entity) { try { db.football_club.Add(entity); db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public ActionResult Edit(football_club pos) { if (ModelState.IsValid) { var dao = new football_club_dao(); var result = dao.Update(pos); if (result) { SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success"); return(RedirectToAction("Index", "FootballClub")); } else { ModelState.AddModelError("", StaticResources.Resources.UpdateFootballClubFailed); } } return(View()); }
public ActionResult Create(football_club club) { if (ModelState.IsValid) { var dao = new football_club_dao(); bool result = dao.Insert(club); if (result) { SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success"); return(RedirectToAction("Index", "FootballClub")); } else { ModelState.AddModelError("", StaticResources.Resources.InsertFootballClubFailed); } } return(View()); }
public bool Update(football_club entity) { try { var info = db.football_club.Find(entity.id); info.name = entity.name; info.pitch = entity.pitch; info.url_logo = entity.url_logo; info.phone_number = entity.phone_number; info.fax_number = entity.fax_number; info.address = entity.address; info.coach = entity.coach; info.detail = entity.detail; info.is_active = entity.is_active; db.SaveChanges(); return(true); } catch (Exception) { return(false); } }