public IActionResult OnPostDelete(int entryId) { var entry = _entryRepository.GetEntryById(entryId); if (entry == null) { SearchMessage = "Entry not found."; return(Page()); } Entry = _entryRepository.DeleteEntry(entryId); _entryRepository.Commit(); SearchMessage = $"{Entry.Name}'s entry deleted successfully"; return(RedirectToPage()); }
public ActionResult Delete(int entryId) { var entry = _entryRepo.GetEntry(entryId); if (entry == null) { return(HttpNotFound()); } GetSignedUser(); if (!_signedUser.CanManageAllContent() && !entry.Account.Equals(_signedUser)) { return(RedirectToAction("Index", "Home")); } _entryRepo.DeleteEntry(entryId); return(RedirectToAction("Index", "Entries")); }