コード例 #1
0
        public HttpResponseMessage CreateFeature([ModelBinder(typeof(IocCustomCreationConverter))] ISPFeature featureEntity)
        {
            try
            {
                var isSuccess = featureService.CreateFeature(featureEntity);

                if (isSuccess)
                {
                    return(CreateHttpResponse <ISPFeature>(
                               HttpStatusCode.Created, HttpCustomStatus.Success, null, GetLocalisedString("msgFeatureCreation")));
                }

                return(CreateHttpResponse <ISPFeature>(
                           HttpStatusCode.Accepted, HttpCustomStatus.Failure, null, GetLocalisedString("msgFeatureDuplicate")));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <ISPFeature>(
                           HttpStatusCode.ExpectationFailed,
                           HttpCustomStatus.Failure,
                           null,
                           GetLocalisedString("msgWebServiceError")));
            }
        }
コード例 #2
0
        /// <summary>
        /// Modifies the feature.
        /// </summary>
        /// <param name="feature">The feature.</param>
        /// <returns>The modification status.</returns>
        public bool UpdateFeature(ISPFeature feature)
        {
            bool result = false;

            result = featureDataService.UpdateFeature(feature);
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// Creates a new feature.
        /// </summary>
        /// <param name="feature">The feature.</param>
        /// <returns>
        /// The creation status.
        /// </returns>
        public bool CreateFeature(ISPFeature feature)
        {
            var featureName = feature.Name.Trim().ToLower();
            var featureLink = feature.ProgramLink.Trim().ToLower();
            var displayName = feature.DisplayName.Trim().ToLower();
            var exists      = features.Entities
                              .Where(x => (x.Name.Trim().ToLower() == featureName ||
                                           x.ProgramLink.Trim().ToLower() == featureLink || x.DisplayName.Trim().ToLower() == displayName) && x.HierarchyId == feature.HierarchyId &&
                                     x.CategoryId == feature.CategoryId)
                              .Any();

            if (!exists)
            {
                var newFeature = features.Add(feature);
                UnitOfWork.Commit();
                return(true);
            }

            return(false);
        }
コード例 #4
0
        /// <summary>
        /// Modifies the feature.
        /// </summary>
        /// <param name="feature">The feature.</param>
        /// <returns>
        /// The modification status.
        /// </returns>
        public bool UpdateFeature(ISPFeature feature)
        {
            var featureName = feature.Name.Trim().ToLower();
            var featureLink = feature.ProgramLink.Trim().ToLower();
            var displayName = feature.DisplayName.Trim().ToLower();
            var exists      = features.Entities
                              .Where(x => (x.Name.Trim().ToLower() == featureName ||
                                           x.ProgramLink.Trim().ToLower() == featureLink || x.DisplayName.Trim().ToLower() == displayName) && x.HierarchyId == feature.HierarchyId &&
                                     x.Id != feature.Id && x.CategoryId == feature.CategoryId)
                              .Any();

            if (!exists)
            {
                features.Update(feature);
                var updatedResult = UnitOfWork.Commit();
                return(updatedResult == 0 ? true : false);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
 /// <summary>
 /// Creates a new feature.
 /// </summary>
 /// <param name="feature">The feature.</param>
 /// <returns>The creation status.</returns>
 public bool CreateFeature(ISPFeature feature)
 {
     return(featureDataService.CreateFeature(feature));
 }
コード例 #6
0
 /// <summary>
 /// Gets the features.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>The ISPFeature Entity</returns>
 public IEnumerable <ISPFeature> GetFeatures(ISPFeature filter)
 {
     return(featureDataService.GetFeatures(filter));
 }
コード例 #7
0
 /// <summary>
 /// Gets the features.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>
 /// The feature colection.
 /// </returns>
 public IEnumerable <ISPFeature> GetFeatures(ISPFeature filter)
 {
     return(features.Entities.Where(x => (x.Name.Contains(filter.Name) || x.Name == null) && (x.IsActive == filter.IsActive)));
 }