コード例 #1
0
        /// <summary>
        /// Creates or updates a package
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult <PackageDefinition> PostSavePackage(PackageDefinition model)
        {
            if (ModelState.IsValid == false)
            {
                return(ValidationProblem(ModelState));
            }

            // Save it
            if (!_packagingService.SaveCreatedPackage(model))
            {
                return(ValidationProblem(
                           model.Id == default
                            ? $"A package with the name {model.Name} already exists"
                            : $"The package with id {model.Id} was not found"));
            }

            // The packagePath will be on the model
            return(model);
        }