Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MasterPagePropertiesInterface m = Master as MasterPagePropertiesInterface;
            if (m != null) m.themeTitle = "Games Edit";

            game _game = new game();

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

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

             _game = _dal.GetGamesById(_guid);


            if (!IsPostBack)
            {

                txtDescription.InnerText = _game.description;
                txtName.Text = _game.name;
                txtTwitchUrl.Text = _game.twitchUrl;
                txtYoutubeUrl.Text = _game.youtubeUrl;

                if (_game.gameCoverImage != null)
                {
                    gameCoverIamgePreview.ImageUrl = _game.gameCoverImage;

                }
                else
                    gameCoverIamgePreview.Enabled = false;
            }
        


    }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {

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

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

            game _game = new game();
            _game = _dal.GetGamesById(_guid);


            _game.name = txtName.Text;
            _game.description = txtDescription.InnerText;
            _game.authCreatedDate = DateTime.Now;
            _game.description = txtDescription.InnerText;
            _game.userId = UserID;
            _game.isDeleted = false;

            _game.isActive = chkIsActive.Checked;
            FileName = Path.GetFileName(gameCoverIamge.PostedFile.FileName);
         
                
                gameCoverIamge.SaveAs(Server.MapPath("~/uploads/covers/small/" + FileName));
          
            _game.gameCoverImage = "~/uploads/covers/small/" +FileName;
            
                _game.authCreatedDate = DateTime.Now;


            if (_guid == Guid.Empty)
                _dal.SkyLarkArenaEntities.games.Add(_game);

            

            _dal.SkyLarkArenaEntities.SaveChanges();
            Response.Redirect("default.aspx");

        }
Exemple #3
0
        public game GetGamesById(Guid _gamesId)
        {
            try
            {
                if (_gamesId == Guid.Empty)
                {
                    game _game = new game();
                    return _game;
                }
                else
                {
                    var q = SkyLarkArenaEntities.games.Where(p => p.id == _gamesId && p.isDeleted == false);

                    if (q == null)
                        throw new EntityContextException(string.Format("A Channel  could not be found {0}!", _gamesId));
                    else
                        return q.ToList()[0];
                }
            }
            catch (Exception ex)
            {
                throw new EntityContextException("GetGamesById failed.", ex);
            }
        }