Beispiel #1
0
        public async Task <JsonResult> EditSection(EditSectionViewModel model)
        {
            try
            {
                if ("colour".Equals(model.BackgroundType, StringComparison.OrdinalIgnoreCase))
                {
                    await _sectionService.EditBackgroundTypeAsync(model.SectionId, false);

                    if (!string.IsNullOrWhiteSpace(model.BackgroundColour))
                    {
                        await _sectionService.EditBackgroundColourAsync(model.SectionId, model.BackgroundColour);
                    }
                }
                else
                {
                    await _sectionService.EditBackgroundTypeAsync(model.SectionId, true);

                    if (model.BackgroundImageId > 0)
                    {
                        var selectedBackgroundImage = await _imageService.GetAsync(model.BackgroundImageId);

                        await _sectionService.EditBackgroundImageAsync(model.SectionId, selectedBackgroundImage.CDNImagePath(), selectedBackgroundImage.ImageCategory);
                    }

                    await _sectionService.EditBackgroundStyleAsync(model.SectionId, model.PageSectionBackgroundStyle);
                }

                await _sectionService.EditHeightAsync(model.SectionId, model.PageSectionHeight);

                await _associationService.EditRolesAsync(model.PageAssociationId, model.SelectedRoleList);

                var pageSection = await _sectionService.GetAsync(model.SectionId);

                return(Json(new { State = true, SectionMarkup = pageSection.PageSectionBody }));
            }
            catch (Exception)
            {
                return(Json(new { State = false }));
            }
        }
        public async Task <HttpStatusCodeResult> EditAccess(EditAccessViewModel model)
        {
            try
            {
                await _associationService.EditRolesAsync(model.PageAssociationId, model.SelectedRoleList);

                return(new HttpStatusCodeResult(HttpStatusCode.NoContent));
            }
            catch (Exception)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
            }
        }