protected void Page_Load(object sender, EventArgs e)
        {
            Leauge _Leauge = new Leauge();

            string id = Request.QueryString["id"];

            Guid _guid = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id);

            _Leauge = _dal.GetLeaguesByLeagueId(_guid);

            if (!Page.IsPostBack)
            {
                txtName.Text = _Leauge.LeagueName;
                txtLeagueId.Text = _Leauge.LeagueID.ToString();

            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {

                string id = Request.QueryString["id"];
                if (id != "00000000-0000-0000-0000-000000000000")
                {
                    _leaugeId = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id);

                }

                Leauge _leauge = new Leauge();
                _leauge = _dal.GetLeaguesByLeagueId(_leaugeId);

                _leauge.LeagueName = txtName.Text;
                _leauge.LeagueID = Convert.ToInt32(txtLeagueId.Text);

                if (id == "00000000-0000-0000-0000-000000000000")
                {

                    _dal.SoccerEntities.AddToLeauges(_leauge);

                }

                _dal.SoccerEntities.SaveChanges();

                Response.Redirect("default.aspx");

            }
            catch (Exception ex)
            {
                Log.Error(string.Format("Prizes Edit Exception {0}", ex.ToString()));

            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Leauges EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLeauges(Leauge leauge)
 {
     base.AddObject("Leauges", leauge);
 }
        public Leauge GetLeaguesByLeagueId(Guid _leagueId)
        {
            try
            {
                if (_leagueId == Guid.Empty)
                {
                    Leauge _league = new Leauge();
                    return _league;
                }
                else
                {
                    var q = SoccerEntities.Leauges.Where(p => p.id == _leagueId);

                    if (q == null)
                        throw new EntityContextException(string.Format("A Prize could not be found {0}!", _leagueId));
                    else
                        return q.ToList()[0];
                }
            }
            catch (Exception ex)
            {
                throw new EntityContextException("GetLeaguesByLeagueId failed.", ex);
            }
        }
 /// <summary>
 /// Create a new Leauge object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static Leauge CreateLeauge(global::System.Guid id)
 {
     Leauge leauge = new Leauge();
     leauge.id = id;
     return leauge;
 }