public JsonResult DeleteSelectedDb(string ids)
        {
            var  model = new SlideDAO();
            var  lstID = ids.Split(',');//chuyển chuỗi thành mảng
            bool res   = true;

            foreach (var id in lstID)
            {
                long cv = Convert.ToInt64(id);
                res = model.Delete(cv);
            }
            return(Json(new
            {
                status = res
            }));
        }
        public ActionResult Delete(int id)
        {
            var dao    = new SlideDAO();
            var result = dao.Delete(id);

            switch (result)
            {
            case true:
            {
                SetAlert("Xóa slide " + id + " thành công!", "success");
                logger.Info("Xóa slide " + id + " thành công!");
                return(RedirectToAction("Index"));
            }

            case false:
            {
                SetAlert("Xóa slide " + id + " không thành công!", "error");
                logger.Error("Xóa slide " + id + " không thành công!");
                return(RedirectToAction("Index"));
            }
            }
            return(RedirectToAction("AllSlide"));
        }
Esempio n. 3
0
        public JsonResult Delete(int id)
        {
            bool isSuccess = slideDAO.Delete(id);

            return(Json(new { status = isSuccess ? 200 : 500 }, JsonRequestBehavior.AllowGet));
        }