public ActionResult DeleteHdlBillPayment(int id) { if (id > 0) { try { financeService.DeleteHdlBillPayment(id); } catch (DbUpdateException ex) when((ex.GetBaseException() as SqlException).Number == 547) { Program.Logger.Error(ex); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.foreignConstraintFailed, "Failed", "This field is being used by some other reference. Please delete the reference first before deleting this.")))); } catch (Exception e) { Program.Logger.Error(e); return(Ok(GetResponse(ResponseType.FAIL, ResponseStatusCode.FAIL, GetError(ErrorCodes.dataNotFound, "Failed", "Error occurred while deleting the bill payment record")))); } return(Ok(GetResponse(ResponseType.ACK, ResponseStatusCode.SUCCESS))); } else { return(BadRequest(GetResponse(ResponseType.ERROR, ResponseStatusCode.ERROR, GetError(ErrorCodes.invalidData, "Invalid input", "Please enter proper bill payment record")))); } }