public async Task <IActionResult> Edit(int id, [Bind("id,uczelnia,wydzial,autor,tytul,kategoria,opis")] Announcement announcement) { if (id != announcement.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(announcement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnnouncementExists(announcement.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(announcement)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Body,DatePosted,Author")] Announcement announcement) { if (id != announcement.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(announcement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnnouncementExists(announcement.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(announcement)); }