public ActionResult Edit([Bind(Include = "TileId,TileType,Title,RefreshPeriod")] Noticeboard noticeboard) { if (ModelState.IsValid) { db.Entry(noticeboard).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(noticeboard)); }
public ActionResult Edit([Bind(Include = "NoticeboardItemId,NoticeboardId,Content")] NoticeboardItem noticeboardItem) { if (ModelState.IsValid) { db.Entry(noticeboardItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "NoticeboardItems", new { id = noticeboardItem.NoticeboardId })); } return(View(noticeboardItem)); }
public ActionResult Edit([Bind(Include = "CalendarItemId,Content,Location,StartTime,EndTime,CalendarId")] CalendarItem calendarItem) { if (ModelState.IsValid) { db.Entry(calendarItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "CalendarItems", new { id = calendarItem.CalendarId })); } return(View(calendarItem)); }
public ActionResult Edit([Bind(Include = "TileId,TileType,Title,SearchCriteria,RefreshPeriod")] Twitter twitter) { if (ModelState.IsValid) { db.Entry(twitter).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(twitter)); }
public ActionResult Edit([Bind(Include = "UserAccountId,OrgName,TileLayoutId")] UserAccount userAccount) { if (ModelState.IsValid) { db.Entry(userAccount).State = EntityState.Modified; db.SaveChanges(); // Check if number of tiles has changed in this edit, if so remove the old tiles for this user and // add the right number of new ones. var num = db.TileLayout.Find(userAccount.TileLayoutId).NumberOfTiles; if (num != savedNumberOfTiles) { var todelete = db.TileLayoutUserLink.Where(d => d.UserAccountId == userAccount.UserAccountId); foreach (var u in todelete) { db.TileLayoutUserLink.Remove(u); } db.SaveChanges(); } // 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)); }
public ActionResult Edit([Bind(Include = "TileLayoutUserLinkId,UserAccountId,TileId")] TileLayoutUserLink model) { var linkToUpdate = db.TileLayoutUserLink.Find(model.TileLayoutUserLinkId); if (linkToUpdate == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ModelState.IsValid) { linkToUpdate.TileId = model.TileId; db.Entry(linkToUpdate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TileId = new SelectList(db.Tile, "TileId", "Title", model.TileId); ViewBag.UserAccountId = new SelectList(db.UserAccount, "UserAccountId", "OrgUnit", model.UserAccountId); return(View(model)); }