File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed
Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -39,23 +39,22 @@ protected Partner()
3939 Accounts = null ;
4040 }
4141
42- /// <summary>
43- ///
44- /// </summary>
45- /// <returns></returns>
46- public string ValidateDelete ( )
42+ public bool CanDelete ( out string errorMessage )
4743 {
44+ errorMessage = string . Empty ;
4845 if ( Contacts . Any ( ) )
4946 {
50- return "Partner has existing Contacts" ;
47+ errorMessage = "Partner has existing Contacts" ;
48+ return false ;
5149 }
5250
5351 if ( Accounts . Any ( ) )
5452 {
55- return "Partner has existing Accounts" ;
53+ errorMessage = "Partner has existing Accounts" ;
54+ return false ;
5655 }
57-
58- return null ;
56+
57+ return true ;
5958 }
6059 }
6160}
Original file line number Diff line number Diff line change @@ -111,10 +111,8 @@ public async Task<IHttpActionResult> DeleteAsync(int id)
111111 {
112112 return NotFound ( ) ;
113113 }
114-
115- var deletionError = partner . ValidateDelete ( ) ;
116-
117- if ( deletionError != null )
114+ ;
115+ if ( partner . CanDelete ( out string deletionError ) )
118116 {
119117 var httpError = new HttpError ( deletionError ) ;
120118
You can’t perform that action at this time.
0 commit comments