Example #1
0
        /// <summary>
        /// Saves associations for the subject entity.
        /// </summary>
        /// <returns>A Boolean value indicating success of operation.</returns>
        public override bool SaveAssociation()
        {
            bool result = false;

            using (ResourceDataAccess dataAccess = new ResourceDataAccess(base.CreateContext()))
            {
                AuthorizeResourcesBeforeSave <Resource>(dataAccess);

                NavigationProperty property = dataAccess.GetNavigationProperty(this.Page.Cache
                                                                               , typeName, _predicateDropDownList.SelectedItem.Text);

                if (property != null &&
                    dataAccess.ValidateAssociation <Resource>(SubjectItemId, property,
                                                              DestinationList as List <Resource>))
                {
                    result = dataAccess.SaveResourceToResourceAssociation <Resource>
                                 (SubjectItemId, property, DestinationList as List <Resource>,
                                 AuthenticatedToken, Constants.PermissionRequiredForAssociation);
                }
            }

            return(result);
        }