public ActionResult Edit(int id, linkMap collection) { if (!Request.IsAuthenticated || !userRepository.canAccessData(User.Identity.Name, "AddFile")) { TempData["message"] = "Bạn không có quyền truy cập vào trang cập nhật link"; TempData["messageType"] = "error"; return(RedirectToAction("Index", "AdminHome")); } try { if (ModelState.IsValid) { repository.saveVideo(collection); TempData["message"] = "Đã cập nhật mới link "; TempData["messageType"] = "inf"; return(RedirectToAction("Index")); } else { TempData["message"] = "Dữ liệu bạn nhập vào không hợp lệ"; TempData["messageType"] = "error"; return(View(collection)); } } catch (Exception ex) { TempData["message"] = "Có lỗi hệ thống : " + ex.Message; TempData["messageType"] = "error"; return(View(collection)); } }
// // GET: /Admin/AdminVideo/Delete/5 public ActionResult Delete(int id) { if (!Request.IsAuthenticated || !userRepository.canAccessData(User.Identity.Name, "AddFile")) { TempData["message"] = "Bạn không có quyền truy cập vào trang xóa link"; TempData["messageType"] = "error"; return(RedirectToAction("Index", "AdminHome")); } linkMap item = repository.linkMap.FirstOrDefault(a => a.id == id); if (item != null) { return(View(item)); } else { TempData["message"] = "Không có link này trong hệ thống"; TempData["messageType"] = "error"; return(RedirectToAction("Index")); } }