Example #1
0
        public async Task <IActionResult> OnPostDeleteAsync(int id)
        {
            string title = (await _bookService.GetByIdAsync(id)).Title;
            await _bookService.RemoveAsync(id);

            LogMessage = $"Book {title} removed succesfully.";

            return(RedirectToPage());
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(RedirectToPage("/Index"));
            }
            Book = await _bookService.GetByIdAsync((int)id);

            return(Page());
        }