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; }
/// <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(); }