protected void btnSave_Click(object sender, EventArgs e) { string id = Request.QueryString["id"]; Guid _guid = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id); SkyLarkArenaDal.channel _channel = new SkyLarkArenaDal.channel(); _channel = _dal.GetChannelsByChannelId(_guid); _channel.name = txtName.Text; _channel.channeldescription = txtDescription.InnerText; _channel.userId = UserID; _channel.isDeleted = false; string FileName; FileName = Path.GetFileName(channelImage.PostedFile.FileName); channelImage.SaveAs(Server.MapPath("~/uploads/covers/small/" + FileName)); _channel.channelimg = "~/uploads/covers/small/" + FileName; if (_guid == Guid.Empty) _dal.SkyLarkArenaEntities.channels.Add(_channel); _dal.SkyLarkArenaEntities.SaveChanges(); Response.Redirect("default.aspx"); }
protected void Page_Load(object sender, EventArgs e) { MasterPagePropertiesInterface m = Master as MasterPagePropertiesInterface; if (m != null) m.themeTitle = "Tournaments Edit"; SkyLarkArenaDal.channel _channel = new SkyLarkArenaDal.channel(); string id = Request.QueryString["id"]; Guid _guid = string.IsNullOrEmpty(id) ? new Guid() : new Guid(id); _channel = _dal.GetChannelsByChannelId(_guid); if (!Page.IsPostBack) { txtName.Text = _channel.name; txtDescription.InnerHtml = _channel.channeldescription; } }
public channel GetChannelsByChannelId(Guid _channelId) { try { if (_channelId == Guid.Empty) { channel _channels = new channel(); return _channels; } else { var q = SkyLarkArenaEntities.channels.Where(p => p.id == _channelId && p.isDeleted == false); if (q == null) throw new EntityContextException(string.Format("A Channel could not be found {0}!", _channelId)); else return q.ToList()[0]; } } catch (Exception ex) { throw new EntityContextException("GetPlayerPointsBYID failed.", ex); } }