// GET: Admin/Author public ActionResult Index(string searchString, int page = 1, int pageSize = 2) { BookAuthorDAO dao = new BookAuthorDAO(); var model = dao.GetListAuthorPaging(searchString, page, pageSize); ViewBag.SearchString = searchString; return(View(model)); }
public ActionResult Delete(long id) { bool success = new BookAuthorDAO().Delete(id); if (success) { SetAlert("Xóa tác giả thành công", "success"); } else { SetAlert("Xóa tác giả thất bại", "warning"); } return(RedirectToAction("Index", "Author")); }
public ActionResult Edit(BookAuthor author) { if (ModelState.IsValid) { bool success = new BookAuthorDAO().Update(author); if (success) { SetAlert("Cập nhật thông tin tác giả thành công", "success"); return(RedirectToAction("Index", "Author")); } else { SetAlert("Cập nhật thông tin tác giả thất bại", "warning"); ModelState.AddModelError("", "Cập nhật thông tin tác giả không thành công"); } } return(RedirectToAction("Index", "Author")); }
public ActionResult Create(BookAuthor author) { if (ModelState.IsValid) { BookAuthorDAO dao = new BookAuthorDAO(); bool success = dao.Insert(author); if (success) { SetAlert("Thêm tác gỉả thành công", "success"); return(RedirectToAction("Index", "Author")); } else { SetAlert("Thêm tác gỉả thất bại", "warning"); ModelState.AddModelError("", "Thêm tác gỉả không thành công"); } } return(RedirectToAction("Index", "Author")); }
public ActionResult Edit(long id) { BookAuthor author = new BookAuthorDAO().getAuthorByID(id); return(View(author)); }