public IActionResult Edit(int id)
        {
            NoticeBoardItem noticeBoardItem = _context.NoticeBoardItems.FirstOrDefault(x => x.Id == id);

            if (noticeBoardItem == null)
            {
                return(RedirectToAction("index"));
            }

            return(View(noticeBoardItem));
        }
        public IActionResult Create(NoticeBoardItem noticeBoardItem)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "sehvlik oldu");
                return(View());
            }
            noticeBoardItem.CreatedAt = DateTime.UtcNow;
            _context.NoticeBoardItems.Add(noticeBoardItem);
            _context.SaveChanges();

            return(RedirectToAction("index"));
        }
        public IActionResult Edit(int id, NoticeBoardItem noticeBoardItem)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            NoticeBoardItem existNoticeBoardItem = _context.NoticeBoardItems.FirstOrDefault(x => x.Id == id);

            if (existNoticeBoardItem == null)
            {
                return(RedirectToAction("index"));
            }
            existNoticeBoardItem.CreatedAt = noticeBoardItem.CreatedAt;
            existNoticeBoardItem.Text      = noticeBoardItem.Text;
            existNoticeBoardItem.CreatedAt = DateTime.UtcNow;


            _context.SaveChanges();

            return(RedirectToAction("index"));
        }