Ejemplo n.º 1
0
 /// <summary>
 /// ɾ³ý
 /// </summary>
 /// <returns></returns>
 public IActionResult OnPostDel(string id)
 {
     if (string.IsNullOrEmpty(id))
     {
         return(new JsonResult(new { success = false, msg = "ɾ³ýʧ°Ü" }));
     }
     using (var db = new DataContext(AppEtl.Db))
     {
         if (IFast.Query <Data_Business_Details>(a => a.Dic == id).ToCount(db) == 0)
         {
             var dicId = IFast.Query <Data_Dic_Details>(a => a.Id == id, a => new { a.DicId }).ToDic(db).GetValue("DicId").ToStr();
             if (IFast.Delete <Data_Dic_Details>(a => a.Id == id, db).IsSuccess)
             {
                 if (IFast.Query <Data_Dic_Details>(a => a.DicId == dicId).ToCount(db) == 0)
                 {
                     IFast.Delete <Data_Dic>(a => a.Id == dicId);
                 }
                 return(new JsonResult(new { success = true, msg = "ɾ³ý³É¹¦" }));
             }
             else
             {
                 return(new JsonResult(new { success = false, msg = "ɾ³ýʧ°Ü" }));
             }
         }
         else
         {
             return(new JsonResult(new { success = false, msg = "×Öµä´æÔÚʹÓÃÖÐ" }));
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// ɾ³ý
        /// </summary>
        /// <returns></returns>
        public IActionResult OnPostDel(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(new JsonResult(new { success = false, msg = "ɾ³ýʧ°Ü" }));
            }

            using (var db = new DataContext(AppEtl.Db))
            {
                if (IFast.Query <Data_Business_Details>(a => a.DataSourceId == id).ToCount(db) == 0)
                {
                    if (IFast.Delete <Data_Source>(a => a.Id == id, db).IsSuccess)
                    {
                        return(new JsonResult(new { success = true, msg = "ɾ³ý³É¹¦" }));
                    }
                    else
                    {
                        return(new JsonResult(new { success = false, msg = "ɾ³ýʧ°Ü" }));
                    }
                }
                else
                {
                    return(new JsonResult(new { success = false, msg = "Êý¾ÝÔ´´æÔÚʹÓÃÖÐ" }));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除列
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult OnPostDel(string id)
        {
            using (var db = new DataContext(AppEtl.Db))
            {
                if (IFast.Query <Data_Business_Details>(a => a.FieldId == id).ToCount(db) == 0)
                {
                    return(new JsonResult(new { success = false, msg = "操作失败" }));
                }
                else
                {
                    var colunm = IFast.Query <Data_Business_Details>(a => a.FieldId == id).ToItem <Data_Business_Details>(db);
                    var table  = IFast.Query <Data_Business>(a => a.Id == colunm.Id).ToItem <Data_Business>(db);

                    if (DataSchema.DropColumn(db, table, colunm) && IFast.Delete <Data_Business_Details>(a => a.FieldId == id).IsSuccess)
                    {
                        return(new JsonResult(new { success = true, msg = "操作成功" }));
                    }
                    else
                    {
                        return(new JsonResult(new { success = false, msg = "操作失败" }));
                    }
                }
            }
        }