public ActionResult DeleteConfirmed(int id) { NoticeboardItem noticeboardItem = db.NoticeboardItem.Find(id); db.NoticeboardItem.Remove(noticeboardItem); db.SaveChanges(); return(RedirectToAction("Index", "NoticeboardItems", new { id = noticeboardItem.NoticeboardId })); }
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 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)); }
// GET: NoticeboardItem/Create public ActionResult Create(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // create a new Noticeboard item to use in the form and set its Noticeboard ID to the current Noticeboard // The Noticeboard ID is part of the Create form and will be passed back when the user clicks the save button. NoticeboardItem noticeboardItem = db.NoticeboardItem.Create(); noticeboardItem.NoticeboardId = id.GetValueOrDefault(); return(View(noticeboardItem)); }
// GET: NoticeboardItem/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } NoticeboardItem noticeboardItem = db.NoticeboardItem.Find(id); if (noticeboardItem == null) { return(HttpNotFound()); } return(View(noticeboardItem)); }
public void CreateNoticeboardMessage(string title, string message) { NoticeboardItem newNotice = new NoticeboardItem(title, message); noticeboard.Add(newNotice); for (int i = 0; i < 3; i++) { AddNegativeComment(newNotice); } NoticeboardItemManager newNoticeManager = Instantiate(noticeboardItemPrefab, noticeboardContent).GetComponent <NoticeboardItemManager>(); newNoticeManager.titleText.text = newNotice.title; newNoticeManager.bodyText.text = newNotice.message; newNoticeManager.AddComments(newNotice.comments); newNoticeManager.transform.SetAsFirstSibling(); }
public void AddPositiveComment(NoticeboardItem noticeboardItem) { noticeboardItem.comments.Add(positiveComments[Random.Range(0, positiveComments.Length)]); }
public void AddNegativeComment(NoticeboardItem noticeboardItem) { noticeboardItem.comments.Add(negativeComments[Random.Range(0, negativeComments.Length)]); }