protected void btnSave_Click(object sender, EventArgs e) { team _team = new team(); if(isSaved==false) _team.isActive = true; Guid id = new Guid(Request.QueryString["id"].ToString()); if (id == Guid.Empty) { id = Guid.NewGuid(); } TeamId = id; //add it it to the tracker. _dal.SoccerEntities.teams.AddObject(_team); _dal.SoccerEntities.SaveChanges(); Response.Redirect("default.aspx?teamID=" + TeamId.ToString()); }
public team GetTeamByTeamId(Guid teamId) { try { if (teamId == Guid.Empty) { team _team = new team(); return _team; } else { var q = SoccerEntities.teams.Where(p => p.id == teamId); if (q == null) throw new EntityContextException(string.Format("A team could not be found {0}!", teamId)); else return q.ToList()[0]; } } catch (Exception ex) { throw new EntityContextException("GetTeamByTeamId failed.", ex); } }
/// <summary> /// Create a new team object. /// </summary> /// <param name="id">Initial value of the id property.</param> public static team Createteam(global::System.Guid id) { team team = new team(); team.id = id; return team; }
/// <summary> /// Deprecated Method for adding a new object to the teams EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToteams(team team) { base.AddObject("teams", team); }