protected void Page_Load(object sender, EventArgs e) { MasterPagePropertiesInterface m = Master as MasterPagePropertiesInterface; if (m != null) m.themeTitle = "Tournaments Edit"; tournament _tournament = new tournament(); string id = Request.QueryString["id"]; Guid _guid = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id); // _tournament = _dal.GetTorunamentById(_guid); if (!Page.IsPostBack) { // txtName.Text = _tournament.name; // txtDescription.InnerText = _tournament.tournamentsDescription; // chkActive.Checked = Convert.ToBoolean(_tournament.isActive); } }
protected void btnCreateTournament_OnClick(object sender, EventArgs e) { tournament _torunamentRecord = new tournament(); _dal.SkyLarkArenaEntities.tournaments.Add(_torunamentRecord); _dal.SkyLarkArenaEntities.SaveChanges(); ScriptManager.RegisterStartupScript(this, GetType(), "dialog", "$(function(){closeModal();});", true); }
protected void btnSave_Click(object sender, EventArgs e) { string id = Request.QueryString["id"]; Guid _guid = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id); tournament _tournament = new tournament(); // if(_dal.Entry(_tournament).State == System.Data.Entity.EntityState.Detached) _dal.SkyLarkArenaEntities.SaveChanges(); }
public tournament GetTorunamentById(Guid _tournamentId) { try { if (_tournamentId == Guid.Empty) { tournament _tournament = new tournament(); return _tournament; } else { var q = SkyLarkArenaEntities.tournaments.Where(p => p.id == _tournamentId && p.isDeleted == false); if (q == null) throw new EntityContextException(string.Format("A Tournaments could not be found {0}!", _tournamentId)); else return q.ToList()[0]; } } catch (Exception ex) { throw new EntityContextException("GetTorunamentById failed.", ex); } }