Beispiel #1
0
        public JsonResult Delete(string companyId)
        {
            try
            {
                List <BaseCompany> companys = CompanyServices.QueryCompanysByMasterID(companyId);
                if (companys.Count > 0)
                {
                    throw new MyException("请先删除下属单位");
                }

                bool result = CompanyServices.Delete(companyId);
                if (!result)
                {
                    throw new MyException("删除下属单位失败");
                }

                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "删除单位失败");
                return(Json(MyResult.Error("删除失败")));
            }
        }
        public async Task <ActionResult> DeleteIds(string ids)
        {
            try
            {
                var result = await _companyServices.Delete(ids);

                if (result.Status == Status.ok)
                {
                    return(Json("ok"));
                }
                else
                {
                    return(Json(result.Message));
                }
            }
            catch
            {
                return(View());
            }
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(int id)

        {
            //if (ModelState.IsValid)
            //{

            try
            {
                // TODO: Add update logic here



                CompanyServices.Delete(id);
                TempData["message"] = "Deleted Successfully";
                ModelState.Clear();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View(ex));
            }

            //}
        }