示例#1
0
        public void Delete()
        {
            const int id    = 1;
            var       model = MenuDao.Delete(id);

            Assert.IsNotNull(model);
        }
 public ActionResult Remove(long?Id)
 {
     if (Id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     Dao.Delete(Id);
     return(RedirectToAction("Index"));
 }
示例#3
0
 public bool Delete(string code)
 {
     try
     {
         return(_menuDao.Delete(code));
     }
     catch (Exception ex)
     {
         nlog.Error(ex, "删除菜单失败!", code);
         return(false);
     }
 }
示例#4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (!Main.Instance.AdminApi.IsPluginAuthorized)
            {
                HttpContext.Current.Response.Write("<h1>未授权访问</h1>");
                HttpContext.Current.Response.End();
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["delete"]) &&
                !string.IsNullOrEmpty(Request.QueryString["menuId"]))
            {
                MenuDao.Delete(Convert.ToInt32(Request.QueryString["menuId"]));
                LtlMessage.Text = Utils.GetMessageHtml("删除成功!", true);
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["up"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["parentId"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["menuId"]))
            {
                MenuDao.UpdateTaxisToUp(Convert.ToInt32(Request.QueryString["parentId"]), Convert.ToInt32(Request.QueryString["menuId"]));
                LtlMessage.Text = Utils.GetMessageHtml("排序成功!", true);
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["down"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["parentId"]) &&
                     !string.IsNullOrEmpty(Request.QueryString["menuId"]))
            {
                MenuDao.UpdateTaxisToDown(Convert.ToInt32(Request.QueryString["parentId"]), Convert.ToInt32(Request.QueryString["menuId"]));
                LtlMessage.Text = Utils.GetMessageHtml("排序成功!", true);
            }

            if (IsPostBack)
            {
                return;
            }

            var menuInfoList = MenuDao.GetMenuInfoList(0);

            RptContents.DataSource     = menuInfoList;
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            BtnAdd.OnClientClick = $"location.href = '{PageMenuSettings.GetRedirectUrl(0, 0)}';return false;";
        }
示例#5
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                MenuDao bdDao = new MenuDao();

                if (bdDao.FindChildMenu(id).Count > 0)
                {
                    SetAlert("Đang sử dụng không được phép xóa", SystemConsts.ALERT_DANGER);
                    return(RedirectToAction("Index"));
                }
                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }