Beispiel #1
0
        // GET: Author/Details/5
        public ActionResult Details(int id)
        {
            var book = _unitOfWork.Books.Get(id);
            var model = new BookAuthorRowViewModel()
            {
                Id = book.Id,
                Title = book.Title,
                FirstName = book.Author.FirstName,
                LastName = book.Author.LastName
            };

            return PartialView("_DetailsPartial", model);
        }
Beispiel #2
0
        public ActionResult Delete(int id, BookAuthorRowViewModel model)
        {
            try
            {
                var existingRecord = _unitOfWork.Books.Get(id);
                _unitOfWork.Books.Delete(existingRecord);

                _unitOfWork.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return PartialView("_DeletePartial");
            }
        }