Example #1
0
        /// <summary>
        /// Creates a theme to apply to the components in an Amplify app.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateTheme service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the CreateTheme service method, as returned by AmplifyUIBuilder.</returns>
        /// <exception cref="Amazon.AmplifyUIBuilder.Model.InternalServerException">
        /// An internal error has occurred. Please retry your request.
        /// </exception>
        /// <exception cref="Amazon.AmplifyUIBuilder.Model.InvalidParameterException">
        /// An invalid or out-of-range value was supplied for the input parameter.
        /// </exception>
        /// <exception cref="Amazon.AmplifyUIBuilder.Model.ResourceConflictException">
        /// The resource specified in the request conflicts with an existing resource.
        /// </exception>
        /// <exception cref="Amazon.AmplifyUIBuilder.Model.ServiceQuotaExceededException">
        /// You exceeded your service quota. Service quotas, also referred to as limits, are the
        /// maximum number of service resources or operations for your Amazon Web Services account.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/amplifyuibuilder-2021-08-11/CreateTheme">REST API Reference for CreateTheme Operation</seealso>
        public virtual Task <CreateThemeResponse> CreateThemeAsync(CreateThemeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateThemeRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateThemeResponseUnmarshaller.Instance;

            return(InvokeAsync <CreateThemeResponse>(request, options, cancellationToken));
        }
Example #2
0
        internal virtual CreateThemeResponse CreateTheme(CreateThemeRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = CreateThemeRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateThemeResponseUnmarshaller.Instance;

            return(Invoke <CreateThemeResponse>(request, options));
        }
Example #3
0
        public async Task <ActionResult> Create(CreateThemeRequest model)
        {
            if (ModelState.IsValid)
            {
                await _themeAdminService.CreateThemeAsync(model);

                return(RedirectToAction("Index", new { subjectId = model.SubjectId }));
            }
            ViewBag.Title = "Add a new theme";
            return(View(model));
        }
Example #4
0
        public ActionResult Create(Guid subjectId)
        {
            CreateThemeRequest createThemeRequest = new CreateThemeRequest()
            {
                SubjectId = subjectId,
                TimeLine  = 1
            };

            ViewBag.Title = "Add a new theme";
            return(View(createThemeRequest));
        }
Example #5
0
        public async Task CreateThemeAsync(CreateThemeRequest model)
        {
            Theme theme = new Theme()
            {
                Id        = Guid.NewGuid(),
                Title     = model.Title,
                Created   = DateTime.UtcNow,
                SubjectId = model.SubjectId,
                TimeLine  = model.TimeLine
            };

            UnitOfWork.ThemeRepository.Add(theme);
            await UnitOfWork.SaveChangesAsync();
        }
Example #6
0
        public async Task <IActionResult> Create(CreateThemeRequest request)
        {
            var dic = new Dictionary <string, string>
            {
                { "--accent-color1", request.AccentColor1 },
                { "--accent-color2", request.AccentColor2 },
                { "--accent-color3", request.AccentColor3 }
            };

            var id = await _themeService.Create(request.Name, dic);

            if (id == 0)
            {
                return(Conflict("Theme with same name already exists"));
            }

            return(Ok(id));
        }