public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Description,IsDeleted,TimeDeleted")] AboutNotice aboutNotice) { if (id != aboutNotice.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(aboutNotice); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AboutNoticeExists(aboutNotice.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(aboutNotice)); }
public async Task <IActionResult> Create([Bind("Id,Title,Description,IsDeleted,TimeDeleted")] AboutNotice aboutNotice) { if (ModelState.IsValid) { _context.Add(aboutNotice); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(aboutNotice)); }
public async Task <IActionResult> Create(AboutNotice aboutNotice) { if (!ModelState.IsValid) { return(View()); } _db.AboutNotices.Add(aboutNotice); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } AboutNotice FindaboutNotice = await _db.AboutNotices.FindAsync(id); if (FindaboutNotice == null) { return(NotFound()); } return(View(FindaboutNotice)); }
public async Task <IActionResult> Detail(int?id) { if (id == null) { return(NotFound()); } AboutNotice aboutnoticeFind = await _db.AboutNotices.FindAsync(id); if (aboutnoticeFind == null) { return(NotFound()); } return(View(aboutnoticeFind)); }
public async Task <IActionResult> DeletePost(int?id) { if (id == null) { return(NotFound()); } AboutNotice aboutNoticeFind = await _db.AboutNotices.FindAsync(id); if (aboutNoticeFind == null) { return(NotFound()); } _db.AboutNotices.Remove(aboutNoticeFind); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Edit(int?id, AboutNotice aboutNotice) { AboutNotice aboutNoticetFind = await _db.AboutNotices.FindAsync(id); if (!ModelState.IsValid) { return(View(aboutNoticetFind)); } if (aboutNotice == null) { return(NotFound()); } if (id == null) { return(NotFound()); } aboutNoticetFind.Date = aboutNotice.Date; aboutNoticetFind.Description = aboutNotice.Description; await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }