コード例 #1
0
        public async Task <IActionResult> Action_Post(string m, int type, params int[] cid)
        {
            Alert.Content = string.Format(m + "/" + type + "/" + cid.Length);

            int x = 0;

            switch (m)
            {
            case "delete":
                x = await cms.DeleteByCidAsync(cid);

                break;

            case "status0":
                x = await cms.SetStatusByCidAsync(cid, 0);

                break;

            case "status1":
                x = await cms.SetStatusByCidAsync(cid, 1);

                break;
            }



            if (x > 0)
            {
                Alert.Content = string.Format("成功操作 {0} 条数据", x);
                Alert.Level   = AlertModel.AlertType.Success;
            }
            else
            {
                Alert.Content = "操作数据失败";
                Alert.Level   = AlertModel.AlertType.Danger;
            }
            return(RedirectToAction(nameof(List), new { type }));
        }