コード例 #1
0
        public ActionResult Create(Memo memo, Frame frame)
        {
            if (ModelState.IsValid)
            {
                memo.Frame = frame;
                db.Memos.Add(memo);
                db.SaveChanges();

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

            memo.Frame = frame;

            this.FillTemplatesSelectList(db, FrameTypes.Memo, memo.Frame.TemplateId);

            return View(memo);
        }
コード例 #2
0
        //
        // GET: /Memo/Create

        public ActionResult Create()
        {
            Frame frame = TempData[FrameController.SelectorFrameKey] as Frame;
            
            if (frame == null || frame.PanelId == 0)
            {
                return RedirectToAction("Create", "Frame");
            }

            Memo memo = new Memo()
            {
                Frame = frame,
            };

            memo.init(db);

            this.FillTemplatesSelectList(db, FrameTypes.Memo);
            
            return View(memo);
        }
コード例 #3
0
        public ActionResult Edit(Memo memo, Frame frame)
        {
            if (ModelState.IsValid)
            {
                db.Entry(frame).State = EntityState.Modified;
                db.Entry(memo).State = EntityState.Modified;
                db.SaveChanges();

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

            memo.Frame = frame;

            this.FillTemplatesSelectList(db, FrameTypes.Memo, memo.Frame.TemplateId);
            
            return View(memo);
        }