public ApiResponse AddServiceCode(ServiceCodeDTO serviceCodeDTO) { ApiResponse response = new ApiResponse(); long serviceCodeId = inventoryManager.ServiceCodeIsNotUnique(serviceCodeDTO.ServiceCode); if (serviceCodeId > 0) { response.AddMessage("ServiceCode", new List <string>() { "This service code is in use. Please choose another." }); } else if (inventoryManager.GeneralLedgerIsNotUnique(serviceCodeDTO.GeneralLedger)) { response.AddMessage("GeneralLedger", new List <string>() { "This General Ledger value is in use. Please choose another." }); } else { response.Id = inventoryManager.AddServiceCode(serviceCodeDTO); if (response.Id == 0) { response.AddMessage("DbError", new List <string>() { "There was an error saving this service code." }); } } return(response); }