Esempio n. 1
0
        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 }));
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        // 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));
        }
Esempio n. 5
0
        // 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));
        }
Esempio n. 6
0
    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();
    }
Esempio n. 7
0
 public void AddPositiveComment(NoticeboardItem noticeboardItem)
 {
     noticeboardItem.comments.Add(positiveComments[Random.Range(0, positiveComments.Length)]);
 }
Esempio n. 8
0
 public void AddNegativeComment(NoticeboardItem noticeboardItem)
 {
     noticeboardItem.comments.Add(negativeComments[Random.Range(0, negativeComments.Length)]);
 }