示例#1
0
        public HttpResponseMessage CreateProductGroup([ModelBinder(typeof(IocCustomCreationConverter))] ISPProductGroup productGroup)
        {
            try
            {
                var creationStatus = productGroupService.Create(productGroup);

                if (creationStatus)
                {
                    return(CreateHttpResponse <ISPProductGroup>(
                               HttpStatusCode.Created, HttpCustomStatus.Success, null, "Product Group created successfully."));
                }
                return(CreateHttpResponse <ISPProductGroup>(
                           HttpStatusCode.Accepted,
                           HttpCustomStatus.Failure,
                           null,
                           "Product group exists for the service provider."));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                return(CreateHttpResponse <ISPProductGroup>(
                           HttpStatusCode.ExpectationFailed, HttpCustomStatus.Failure, null,
                           "Web Service Error: Please report this problem or try again later."));
            }
        }
示例#2
0
        /// <summary>
        /// Creates the specified product group.
        /// </summary>
        /// <param name="productGroup">The product group.</param>
        /// <returns>Creation status.</returns>
        public bool Create(ISPProductGroup productGroup)
        {
            var existancyStatus = productGroups.Entities
                                  .Any(x => x.ServiceProviderId == productGroup.ServiceProviderId &&
                                       x.Name == productGroup.Name);

            if (!existancyStatus)
            {
                var newProductGroup = productGroups.Add(productGroup);
                var creationStatus  = UnitOfWork.Commit();
                return((creationStatus == 0) ? true : false);
            }

            return(false);
        }
示例#3
0
        /// <summary>
        /// Modifies the specified product group.
        /// </summary>
        /// <param name="productGroup">The product group.</param>
        /// <returns>The modification status.</returns>
        public bool Modify(ISPProductGroup productGroup)
        {
            var existancyStatus = productGroups.Entities
                                  .Any(x => x.ServiceProviderId == productGroup.ServiceProviderId &&
                                       x.Name == productGroup.Name &&
                                       x.Id != productGroup.Id);

            if (!existancyStatus)
            {
                productGroups.Update(productGroup);
                var updateStatus = UnitOfWork.Commit();
                return((updateStatus == 0) ? true : false);
            }

            return(false);
        }
 /// <summary>
 /// Modifies the specified product group.
 /// </summary>
 /// <param name="productGroup">The product group.</param>
 /// <returns>The modification status.</returns>
 public bool Modify(ISPProductGroup productGroup)
 {
     return(productGroupDataService.Modify(productGroup));
 }
 /// <summary>
 /// Creates the specified product group.
 /// </summary>
 /// <param name="productGroup">The product group.</param>
 /// <returns>Creation status.</returns>
 public bool Create(ISPProductGroup productGroup)
 {
     return(productGroupDataService.Create(productGroup));
 }