OOPhoto: Facade Layer Integrated Between Controller And Service Layers

<!--- Save the gallery. --->
<cfset LOCAL.Results = ARGUMENTS.Data.Cache.Factory
	.Get( "PhotoGalleryFacade" )
	.SavePhotoGallery(
		ID = ARGUMENTS.Data.Attributes.id,
		Name = ARGUMENTS.Data.Form.name,
		Description = ARGUMENTS.Data.Form.description,
		PhotoIDList = ARGUMENTS.Data.Form.photo_id_list
		)
	/>
 
 
<!--- Check to see if we have any errors. --->
<cfif NOT LOCAL.Results.Success>
 
	<!---
		There were object validation errors. Now, we need
		to return the errors to the View in a way that will
		make sense.
	--->
	<cfif StructKeyExists( LOCAL.Results.Errors, "Name" )>
 
		<cfset LOCAL.Errors.name = LOCAL.Results.Errors.Name />
 
	</cfif>
 
	<cfif StructKeyExists( LOCAL.Results.Errors, "Description" )>
 
		<cfset LOCAL.Errors.description = LOCAL.Results.Errors.Description />
 
	</cfif>
 
	<cfif StructKeyExists( LOCAL.Results.Errors, "Photos" )>
 
		<cfset LOCAL.Errors.photo_id_list = LOCAL.Results.Errors.Photos />
 
	</cfif>
 
<cfelse>
 
	<!--- Redirect to gallery detail. --->
	<cflocation
		url="......id=#LOCAL.Results.PhotoGallery.GetID()#"
		addtoken="false"
		/>
 
</cfif>

For Cut-and-Paste