Пример #1
0
        public IActionResult Edit(int id)
        {
            var entity = _bookService.GetBookById(id);
            var model  = new AdminBookEditVM();

            model.Id          = entity.Id;
            model.Price       = entity.Price;
            model.Description = entity.Description;
            model.BookPages   = entity.BookPages;
            model.BookName    = entity.Title;
            return(View(model));
        }
Пример #2
0
        public IActionResult Edit(AdminBookEditVM model)
        {
            var entity = _bookService.GetBookById(model.Id);

            entity.Id          = model.Id;
            entity.Price       = model.Price;
            entity.Description = model.Description;
            entity.BookPages   = model.BookPages;
            var result = _bookService.Edit(entity);

            if (result == 1)
            {
                TempData["IslemBasarili"] = "Kitap güncellenmiştir.";
            }
            else
            {
                TempData["IslemBasarisiz"] = "Kitap güncellenememiştir.";
            }

            return(View(model));
        }