Example #1
0
        public async Task <IActionResult> Edit(BookFormAdminModel model)
        {
            var book = await this.books.EditAsync(model.Id, model.Title, model.Description);

            TempData.AddSuccessMessage($"Successfully edited {book} book.");

            return(this.RedirectToActionExtensionMethod(nameof(Index)));
        }
Example #2
0
        public async Task <IActionResult> Delete(int id)
        {
            var book = await this.books.ByIdAsync(id);

            if (book == null)
            {
                return(NotFound());
            }

            var model = new BookFormAdminModel
            {
                Id    = id,
                Title = book.Title,
            };

            return(View(model));
        }