예제 #1
0
        public ActionResult Add(string packageName, string userEmail)
        {
            this.EnsureUserEmailIsNotChanged(userEmail);

            var request = new AddPackageRequest { IdentityToken = userEmail, Name = packageName };

            var response = this.packagesService.AddPackage(request);
            var result = response.ConvertToPackageViewModel();
            result.Message = DashboardViewResources.PackageCreatedSuccessMessage;
            result.MessageType = MessageType.Success.ToString();

            var jsonNetResult = new JsonNetResult
            {
                Formatting = (Formatting)Newtonsoft.Json.Formatting.Indented,
                Data = result
            };
            return jsonNetResult;
        }
예제 #2
0
        /// <summary>
        /// Add new package.
        /// </summary>
        /// <param name="request">
        /// The add package request message.
        /// </param>
        /// <returns>
        /// The add package response message.
        /// </returns>
        public AddPackageResponse AddPackage(AddPackageRequest request)
        {
            var newPackage = new Package { Name = request.Name, CreatedDate = DateTime.UtcNow, Dimensions = new Dimensions() };

            var packageResult = this.packageRepository.AddPackage(request.IdentityToken, newPackage);
            return packageResult.ConvertToAddPackageResponse();
        }