// GET: /Outlook/Create public ActionResult Create() { Frame frame = TempData[FrameController.SelectorFrameKey] as Frame; if (frame == null || frame.PanelId == 0) { return RedirectToAction("Create", "Frame"); } Outlook outlook = new Outlook(frame, db); this.FillTemplatesSelectList(db, FrameTypes.Outlook); FillModesSelectList(); FillAccountsSelectList(); FillPrivacySelectList(); return View(outlook); }
public ActionResult Create(Outlook outlook) { if (!string.IsNullOrWhiteSpace(outlook.Mailbox)) { Match lnk = _emailRgx.Match(outlook.Mailbox); outlook.Mailbox = lnk.Success ? lnk.Value : ""; } if (ModelState.IsValid) { db.Frames.Add(outlook); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.TemplateId); FillModesSelectList(outlook.Mode); FillAccountsSelectList(outlook.AccountId); FillPrivacySelectList(outlook.Privacy); return View(outlook); }