Пример #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());
        }
Пример #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(RedirectToPage("/Index"));
            }
            Book = await _bookService.GetByIdAsync((int)id);

            return(Page());
        }