예제 #1
0
		public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
		{
			var systemName = controllerContext.GetAgentSystemName();

			var metadata = _resolvers.GetAgentMetadata(systemName);

			var partName = controllerContext.GetPartName();

			var descriptiveName = controllerContext.GetRouteValue<string>("descriptiveName");

			IPartCollection partCollection;
			if (string.IsNullOrEmpty(partName))
			{
				partCollection = metadata.GetPartCollectionByDescriptiveName(descriptiveName);
			}
			else
			{
				partCollection = metadata.GetPartCollectionContainingPartName(partName);
			}

			if (partCollection == null)
			{
				throw new PartCollectionNotFoundException();
			}

			return partCollection;
		}