Exemplo n.º 1
0
        public HttpResponseMessage Delete(Guid id)
        {
            try
            {
                var result = company.DeleteCompany(id);
                if (result)
                {
                    var response = new HttpResponseMessage()
                    {
                        StatusCode = HttpStatusCode.OK
                    };

                    return(response);
                }
                else
                {
                    var response = new HttpResponseMessage()
                    {
                        StatusCode = HttpStatusCode.BadRequest
                    };
                    return(response);
                }
            }
            catch (Exception)
            {
                var response = new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.InternalServerError
                };
                return(response);
            }
        }
Exemplo n.º 2
0
        public async Task<JsonResult> DeleteCompany(int companyId)
        {
            JsonData<JsonStatus> data = new JsonData<JsonStatus>(new JsonStatus());
            if (true == await _company.DeleteCompany(companyId))
            {
                data.Result.Status = true;
            }

            return Json(data); // returns.
        }
        public ActionResult DeleteConfirmed(int id)
        {
            try
            {
                Companies companies = companyRepository.GetCompaniesById(id);

                companyRepository.DeleteCompany(id);
                companyRepository.Save();
            }
            catch (DataException)
            {
                return(RedirectToAction("Delete", new { id = id, saveChangesError = true }));
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据公司ID删除公司(自己不能删除自己)
        /// </summary>
        /// <param name="Id">公司ID号</param>
        public static void DeleteCompany(int Id)
        {
            CompanyInfo Model = new CompanyInfo();

            Model.ParentIdCondition = Id.ToString();
            //Model.CompanyId = CompanyId;
            if (ReadCompanyList(Model).Count > 0)
            {
                ScriptHelper.Alert("旗下有子公司,请先删除子公司后再进行删除!");
            }
            else
            {
                UserBLL.DeleteUserByCompanyID(Id);
                dal.DeleteCompany(Id);
                companyDic.Remove(Id);
            }
        }
Exemplo n.º 5
0
        public ActionResult DeleteCompany(int id)
        {
            var deleteCompany = _company.DeleteCompany(id);

            return(Ok(deleteCompany));
        }
Exemplo n.º 6
0
 public IActionResult Delete(int id)
 {
     _employRepo.DeleteCompany(id);
     return(RedirectToAction("index"));
 }