예제 #1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            bool result;

            // 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.DeleteCommentAsync(id.Value);

                // result ar trebui valorificat mai departe in cod...
            }
            catch (Exception ex)
            {
                return(RedirectToPage("/Error"));
            }

            return(RedirectToPage("../Posts/Index"));
        }