public ActionResult Create([Bind(Include = "CalendarItemId,CalendarId,Content,Location,StartTime,EndTime")] CalendarItem calendarItem) { if (ModelState.IsValid) { db.CalendarItem.Add(calendarItem); db.SaveChanges(); return(RedirectToAction("Index", "CalendarItems", new { id = calendarItem.CalendarId })); } return(View(calendarItem)); }
public ActionResult Create([Bind(Include = "TileId,TileType,Title,RefreshPeriod")] Noticeboard noticeboard) { if (ModelState.IsValid) { noticeboard.TileType = 1; db.Tile.Add(noticeboard); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(noticeboard)); }
public ActionResult Create([Bind(Include = "NoticeboardItemId,NoticeboardId,Content")] NoticeboardItem noticeboardItem) { if (ModelState.IsValid) { // New Noticeboard item is added to the list of Noticeboard Items db.NoticeboardItem.Add(noticeboardItem); db.SaveChanges(); return(RedirectToAction("Index", "NoticeboardItems", new { id = noticeboardItem.NoticeboardId })); } return(View(noticeboardItem)); }
public ActionResult Create([Bind(Include = "TileId,TileType,Title,RssUrl,RefreshPeriod")] Newsfeed newsfeed) { if (ModelState.IsValid) { newsfeed.TileType = 3; db.Tile.Add(newsfeed); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(newsfeed)); }
public ActionResult Create([Bind(Include = "TileId,Title,RefreshPeriod")] Calender calender) { if (ModelState.IsValid) { calender.TileType = 2; db.Tile.Add(calender); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(calender)); }
public ActionResult Create([Bind(Include = "TileId,TileType,Title,SearchCriteria,RefreshPeriod")] Twitter twitter) { if (ModelState.IsValid) { twitter.TileType = 4; db.Tile.Add(twitter); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(twitter)); }
public ActionResult Create([Bind(Include = "TileLayoutUserLinkId,UserAccountId,TileId")] TileLayoutUserLink tileLayoutUserLink) { if (ModelState.IsValid) { db.TileLayoutUserLink.Add(tileLayoutUserLink); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TileId = new SelectList(db.Tile, "TileId", "Title", tileLayoutUserLink.TileId); ViewBag.UserAccountId = new SelectList(db.UserAccount, "UserAccountId", "OrgUnit", tileLayoutUserLink.UserAccountId); return(View(tileLayoutUserLink)); }
public ActionResult Create([Bind(Include = "UserAccountId,OrgName,TileLayoutId")] UserAccount userAccount) { if (ModelState.IsValid) { db.UserAccount.Add(userAccount); db.SaveChanges(); // Add tile entries for the tile type for this user account var num = db.TileLayout.Find(userAccount.TileLayoutId).NumberOfTiles; // Find a valid tile to use for initializing the new tiles var tile = db.TileLayoutUserLink.FirstOrDefault(d => d.TileId != 0); if (tile != null) { //add new tiles for this user for (var i = 0; i < num; i++) { db.TileLayoutUserLink.Add(new TileLayoutUserLink { TileId = tile.TileId, // The Tile to display UserAccountId = userAccount.UserAccountId }); } } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TileLayoutId = new SelectList(db.TileLayout, "TileLayoutId", "Description", userAccount.TileLayoutId); return(View(userAccount)); }