public async Task <ActionResult> DeleteCompany(int id) { if (_companyService.Delete(id)) { return(Ok("Kompanija je uspesno obrisana!")); } return(BadRequest("Kompaniju nije moguce obrisati!")); }
//============================== DELETE ============================== public IActionResult Delete(int id) { if (ModelState.IsValid) { // Delete Article Based On The ID company.Delete(id); } return(View()); }
public IActionResult Delete(int pId) { var retval = _companyRepo.Delete(pId); if (!retval) { return(StatusCode(StatusCodes.Status400BadRequest, ErrorNoCompanyId.Replace("@Id", pId.ToString()))); } return(StatusCode(StatusCodes.Status200OK)); }
public async Task <IActionResult> OnPostAsync() { if (Company == null) { return(RedirectToPage("../Index")); } db.Delete(Company); await db.CommitAsync(); TempData["CompanyDelete"] = "Your company has been removed!"; return(RedirectToPage("../Index")); }
public override async Task <UpsertCompanyResponse> DeleteCompany(SearchCompanyRequest request, ServerCallContext context) { if (_companyService.Delete(request.CompanyId)) { _logger.LogInformation("company deleted"); return(new UpsertCompanyResponse { Status = StatusCode.Ok, Message = "kompanija je uspesno obrisana" }); } _logger.LogError("company can't be deleted"); return(new UpsertCompanyResponse { Status = StatusCode.Error, Message = "kompaniju nije moguce obrisati" }); }
public static bool Delete(string recordId) { if (string.IsNullOrWhiteSpace(recordId)) { throw new ArgumentNullException("recordId"); } ICompany factory = CompanyFactory.GetFactory(); BaseCompany model = factory.QueryCompanyByRecordId(recordId); if (model == null) { throw new MyException("待删除的单位不存在"); } List <BaseCompany> models = factory.QueryCompanysByMasterID(model.CPID); if (models.Count > 0) { throw new MyException("请先删除该公司下的所有下级公司"); } List <BaseVillage> villages = VillageServices.QueryVillageByCompanyId(recordId); if (villages.Count != 0) { throw new MyException("请先删除该单位下的所有的小区"); } ISysUser factoryUser = SysUserFactory.GetFactory(); using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { try { dbOperator.BeginTransaction(); bool result = factory.Delete(recordId, dbOperator); if (!result) { throw new MyException("移除单位信息失败"); } result = factoryUser.DeleteByCompanyId(recordId, dbOperator); if (!result) { throw new MyException("移除用户信息失败"); } dbOperator.CommitTransaction(); if (result) { OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("recordId:{0}", recordId)); } return(result); } catch { dbOperator.RollbackTransaction(); throw; } } }
public void DeleteCompany(CompanyTBL companyTBL) { _compRespository.Delete(companyTBL); }
public static bool Delete(int companyId) { return(dal.Delete(companyId)); }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete(string CODE) { return(dal.Delete(CODE)); }
public int Delete(Guid id) { return(dal.Delete(id)); }
public async Task Delete(Core.Models.Company entity) { await _company.Delete(entity); }
public ResultModel Delete(int ID) { return(_svr.Delete(ID)); }
/// <summary> /// 删除对应数据 /// </summary> /// <param name="Id"></param> /// <returns></returns> public int Delete(object Id) { return(dal.Delete(Id)); }
public async Task Delete(int id) { await _service.Delete(id); }