Example #1
0
        public ActionResult Delete(string GroupIds)
        {
            ResultHelper objResult = null;

            try
            {
                using (LedDb db = new LedDb())
                {
                    if (ModelState.IsValid)
                    {
                        string[] Id     = GroupIds.Split(',');
                        string   strMsg = string.Empty;
                        for (int i = 0; i < Id.Length; i++)
                        {
                            GroupBll.DeleteAGroup(int.Parse(Id[i]), out strMsg);
                        }
                        objResult = new ResultHelper()
                        {
                            Status = true,
                            Ret    = 0,
                            Obj    = GroupIds,
                            Msg    = strMsg,
                            Desc   = strMsg
                        };
                        //StringBuilder strSql = new StringBuilder();
                        //strSql.AppendFormat(@"UPDATE GroupInfo SET IsDel = 1 WHERE Id IN ({0})", GroupIds);
                        //if (db.Database.ExecuteSqlCommand(strSql.ToString()) > 0)
                        //{

                        //    objResult = new ResultHelper()
                        //    {
                        //        Status = true,
                        //        Ret = 0,
                        //        Obj = GroupIds,
                        //        Msg = "Delete Success!",
                        //        Desc = "Delete Success!"
                        //    };
                        //}
                        //else
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Desc = "Delete Faile,please try again.",
                        //        Msg = "Delete Faile,please try again.",
                        //        Obj = null,
                        //        Ret = -1,
                        //        Status = false
                        //    };
                        //}
                    }
                    else
                    {
                        objResult = new ResultHelper()
                        {
                            Desc   = " Faile,please try again",
                            Msg    = " Faile,please try again",
                            Obj    = null,
                            Ret    = -1,
                            Status = false
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                objResult = new ResultHelper()
                {
                    Desc   = ex.Message,
                    Msg    = ex.Message,
                    Obj    = null,
                    Ret    = -1,
                    Status = false
                };
            }
            return(Json(objResult));
        }