コード例 #1
0
        public HttpResponseMessage Post([FromBody] Bundle bundle)
        {
            if (bundle == null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new Bundle()));
            }

            var addBundleDto = Mapper.Map(_bundleService.AddBundle(bundle));

            return(Request.CreateResponse(HttpStatusCode.OK, addBundleDto));
        }
コード例 #2
0
        public bool AddBundleS([FromBody] BundleListModel bundleList)
        {
            int           projectId = bundleList.projectId;
            List <Bundle> bundles   = bundleList.Bundles;

            foreach (var bundle in bundles)
            {
                if (bundle != null)
                {
                    BundleOptions bundleOpt = new BundleOptions
                    {
                        Prize       = bundle.Prize,
                        Description = bundle.Description
                    };
                    Bundle addedBundle = bundleService.AddBundle(bundleOpt, projectId);
                }
            }

            return(true);
        }