public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } int result = 0; try{ result = await pcc.DeletePostAsync(id.Value); }catch (Exception ex) { return(RedirectToPage("/Error")); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } int result = 0; try { result = await pcc.DeletePostAsync(id.Value); // result ar trebui valorificat mai departe in cod... } catch (Exception ex) { return(RedirectToPage("/Error")); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } int result = 0; // Nu pot fi sterse inregistrari parinte daca exista descendenti (cheie FK activa) // "Prind" exceptia si afisez o pagina cu eroare. Nu e finisat aici... try { result = await pcc.DeletePostAsync(id.Value); // result ar trebui valorificat mai departe in cod... } catch (Exception) { return(RedirectToPage("/Error")); } return(RedirectToPage("./Index")); }