//
        // GET: /Panel/Create
        public ActionResult Create(int canvasId = 0)
        {
            Panel panel = new Panel(db);

            FillCanvasSelectList(canvasId);

            return View(panel);
        }
        public ActionResult Create(Panel panel)
        {
            if (ModelState.IsValid)
            {
                db.Panels.Add(panel);
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index");
            }

            FillCanvasSelectList(panel.CanvasId);

            return View(panel);
        }
        private void makeFullscreenPanel(Canvas canvas)
        {
            Panel panel = new Panel()
            {
                Left = 0,
                Top = 0,
                Height = canvas.Height,
                Width = canvas.Width,
                Name = "Full-screen",   // TODO: resource
                Canvas = canvas,
            };

            FullScreen fullScreen = new FullScreen()
            {
                Canvas = canvas,
                Panel = panel,
            };

            fullScreen.init(db);

            panel.FullScreens.Add(fullScreen);
            canvas.Panels.Add(panel);
        }
        public ActionResult Edit(Panel panel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(panel).State = EntityState.Modified;
                db.SaveChanges();

                return this.RestoreReferrer() ?? RedirectToAction("Index");
            }

            return View(panel);
        }