Exemplo n.º 1
0
        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.SkyLarkArenaEntities.teams.Add(_team);


            _dal.SkyLarkArenaEntities.SaveChanges();

            Response.Redirect("default.aspx?teamID=" + TeamId.ToString());




        }
Exemplo n.º 2
0
        public team GetTeamByTeamId(Guid  teamId)
             {
            try
            {
                if (teamId == Guid.Empty)
                {
                    team _team = new team();
                   
                    return _team;
                }
                else
                {
                    var q = SkyLarkArenaEntities.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);
            }
      



        }