public ActionResult Create([Bind(Include = "FrameId,Mode,Name,AccountId,Mailbox,ShowEvents")] Outlook outlook, Frame frame) { if (!string.IsNullOrWhiteSpace(outlook.Mailbox)) { Match lnk = _emailRgx.Match(outlook.Mailbox); outlook.Mailbox = lnk.Success ? lnk.Value : ""; } if (ModelState.IsValid) { outlook.Frame = frame; db.Outlooks.Add(outlook); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Outlook, outlook.Frame.TemplateId); FillModesSelectList(outlook.Mode); FillAccountsSelectList(outlook.AccountId); outlook.Frame = frame; return View(outlook); }
public ActionResult Create(Video video, Frame frame) { video.Frame = frame; if (ModelState.IsValid) { if (video.SavedContentId.HasValue) { Content content = db.Contents.Find(video.SavedContentId.Value); video.Contents.Add(content); db.Videos.Add(video); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } else { TempData["_newVideo"] = video; return RedirectToAction("Upload", "Video"); } } this.FillTemplatesSelectList(db, FrameTypes.Video, video.Frame.TemplateId); FillVideosSelectList(); return View(video); }
public ActionResult Create(Picture picture, Frame frame) { picture.Frame = frame; if (ModelState.IsValid) { if (picture.SavedContentId.HasValue) { picture.ContentId = picture.SavedContentId.Value; db.Pictures.Add(picture); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } else { TempData["_newPicture"] = picture; return RedirectToAction("Upload", "Picture"); } } this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.Frame.TemplateId); FillPicturesSelectList(); FillModesSelectList(); return View(picture); }
public Frame(Frame _fromFrame) { //this.FrameId = _fromFrame.FrameId; this.PanelId = _fromFrame.PanelId; this.Duration = _fromFrame.Duration; this.BeginsOn = _fromFrame.BeginsOn; this.EndsOn = _fromFrame.EndsOn; this.Sort = _fromFrame.Sort; //this.DateCreated = _fromFrame.DateCreated; //this.Version = _fromFrame.Version; this.TemplateId = _fromFrame.TemplateId; this.CacheInterval = _fromFrame.CacheInterval; }
public ActionResult Create([Bind(Include = "FrameId,Name,Content")] Html html, Frame frame) { if (ModelState.IsValid) { html.Frame = frame; db.Html.Add(html); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } html.Frame = frame; this.FillTemplatesSelectList(db, FrameTypes.Html, frame.TemplateId); return View(html); }
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); }
public ActionResult Create(Weather weather, Frame frame) { if (ModelState.IsValid) { weather.Frame = frame; db.Weathers.Add(weather); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Weather, weather.Frame.TemplateId); FillWeatherTypeSelectList(); weather.Frame = frame; return View(weather); }
public ActionResult Create(Clock clock, Frame frame) { if (ModelState.IsValid) { clock.Frame = frame; db.Clocks.Add(clock); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Clock, clock.Frame.TemplateId); this.FillSystemTimeZoneSelectList(clock.TimeZone); FillClockTypeSelectList(); clock.Frame = frame; return View(clock); }
public ActionResult Create(Report report, Frame frame) { if (ModelState.IsValid) { report.Frame = frame; db.Reports.Add(report); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Report, report.Frame.TemplateId); FillServersSelectList(); FillModesSelectList(); report.Frame = frame; return View(report); }
public ActionResult Create([Bind(Include = "FrameId,Name,YoutubeId,Volume,AutoLoop,Aspect,Quality,Rate,Start")] Youtube youtube, Frame frame) { if (ModelState.IsValid) { Match lnk = _youTubeLink.Match(youtube.YoutubeId); if (lnk.Success) youtube.YoutubeId = lnk.Value; youtube.Frame = frame; db.Youtube.Add(youtube); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.YouTube, youtube.Frame.TemplateId); FillAspectsSelectList(); FillQualitySelectList(); FillRatesSelectList(); youtube.Frame = frame; return View(youtube); }
public Outlook(Frame _fromFrame, DisplayMonkeyEntities db) : base(_fromFrame) { init(db); }
public ActionResult Edit(Weather weather, Frame frame) { if (ModelState.IsValid) { db.Entry(frame).State = EntityState.Modified; db.Entry(weather).State = EntityState.Modified; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Weather, weather.Frame.TemplateId); FillWeatherTypeSelectList(); weather.Frame = frame; return View(weather); }
public ActionResult Edit([Bind(Include="FrameId,Name,Content")] Html html, Frame frame) { if (ModelState.IsValid) { db.Entry(frame).State = EntityState.Modified; db.Entry(html).State = EntityState.Modified; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } html.Frame = frame; this.FillTemplatesSelectList(db, FrameTypes.Html, html.Frame.TemplateId); return View(html); }
public Picture(Frame _fromFrame, DisplayMonkeyEntities db) : base(_fromFrame) { init(db); }
public ActionResult Edit(Video video, Frame frame) { if (ModelState.IsValid) { db.Entry(frame).State = EntityState.Modified; db.Entry(video).State = EntityState.Modified; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } video.Frame = frame; this.FillTemplatesSelectList(db, FrameTypes.Video, video.Frame.TemplateId); return View(video); }
public ActionResult Upload(Video video, Frame frame, IEnumerable<HttpPostedFileBase> files) { video.Frame = frame; // TODO: EditorFor bool hasFiles = false, addedFiles = false; foreach (HttpPostedFileBase file in files) { if (file != null && file.ContentLength > 0) { string ext = Path.GetExtension(file.FileName).Replace(".", "").ToUpper(); bool isVideo = Video.SupportedFormats.Contains(ext); if (isVideo) { byte[] buffer = null; using (BinaryReader reader = new BinaryReader(file.InputStream)) { buffer = reader.ReadBytes(file.ContentLength); } Content content = new Content { Type = ContentTypes.ContentType_Video, Name = Path.GetFileName(file.FileName), Data = buffer, }; video.Contents.Add(content); addedFiles = true; } hasFiles = true; } } if (addedFiles) { db.Videos.Add(video); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } else if (hasFiles) { // TODO: validator for wrong file types } this.FillTemplatesSelectList(db, FrameTypes.Video, video.Frame.TemplateId); FillVideosSelectList(); ViewBag.MaxVideoSize = Setting.GetSetting(db, Setting.Keys.MaxVideoSize).IntValuePositive; return View(video); }
public Powerbi(Frame _fromFrame, DisplayMonkeyEntities db) : base(_fromFrame) { init(db); }
public ActionResult Edit(Picture picture, Frame frame) { if (ModelState.IsValid) { db.Entry(frame).State = EntityState.Modified; db.Entry(picture).State = EntityState.Modified; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.Frame.TemplateId); FillPicturesSelectList(picture.ContentId); FillModesSelectList(picture.Mode); picture.Frame = frame; return View(picture); }
// // GET: /Frame/Create public ActionResult Create(int canvasId = 0, int panelId = 0, FrameTypes? frameType = null) { Panel panel = null; if (panelId != 0) { panel = db.Panels .Include(p => p.Canvas) .FirstOrDefault(p => p.PanelId == panelId) ; if (panel == null) panelId = 0; } if (frameType == null || panel == null) { if (canvasId == 0 && panel != null) canvasId = panel.CanvasId; return RedirectToAction("ForFrameType", new { canvasId = canvasId, panelId = panelId, frameType = frameType }); } TempData[SelectorFrameKey] = new Frame() { Panel = panel, PanelId = panelId, CacheInterval = 0, }; return RedirectToAction("Create", frameType.ToString()); }
public Memo(Frame _fromFrame, DisplayMonkeyEntities db) : base(_fromFrame) { init(db); }
public ActionResult Edit(Clock clock, Frame frame) { if (ModelState.IsValid) { db.Entry(frame).State = EntityState.Modified; db.Entry(clock).State = EntityState.Modified; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Clock, clock.Frame.TemplateId); this.FillSystemTimeZoneSelectList(clock.TimeZone); FillClockTypeSelectList(); clock.Frame = frame; return View(clock); }
public ActionResult Edit(Report report, Frame frame) { if (ModelState.IsValid) { db.Entry(frame).State = EntityState.Modified; db.Entry(report).State = EntityState.Modified; db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } this.FillTemplatesSelectList(db, FrameTypes.Report, report.Frame.TemplateId); FillServersSelectList(report.ServerId); FillModesSelectList(report.Mode); report.Frame = frame; return View(report); }
public Youtube(Frame _fromFrame, DisplayMonkeyEntities db) : base(_fromFrame) { init(db); }
public Weather(Frame _fromFrame, DisplayMonkeyEntities db) : base(_fromFrame) { init(db); }
private void FillTimingOptionsSelectList(Frame.TimingOptions? selected = null) { ViewBag.TimingOption = selected.TranslatedSelectList(valueAsText: false); }
public ActionResult Upload(Picture picture, Frame frame, HttpPostedFileBase file) { picture.Frame = frame; if (ModelState.IsValid && file != null && file.ContentLength > 0) { // TODO: EditorFor, validate file type string ext = Path.GetExtension(file.FileName).Replace(".", "").ToUpper(); if (Picture.SupportedFormats.Contains(ext)) { byte[] buffer = null; using (BinaryReader reader = new BinaryReader(file.InputStream)) { buffer = reader.ReadBytes(file.ContentLength); } picture.Content = new Models.Content { Type = ContentTypes.ContentType_Picture, Name = Path.GetFileName(file.FileName), Data = buffer, }; db.Pictures.Add(picture); db.SaveChanges(); return this.RestoreReferrer() ?? RedirectToAction("Index", "Frame"); } } this.FillTemplatesSelectList(db, FrameTypes.Picture, picture.Frame.TemplateId); FillPicturesSelectList(); FillModesSelectList(); ViewBag.MaxImageSize = Setting.GetSetting(db, Setting.Keys.MaxImageSize).IntValuePositive; return View(picture); }