Exemplo n.º 1
0
        private void SetPageData(AmpPage ampPageData, ILocatable locatableItem)
        {
            this.ViewBag.Title = ampPageData.Title;

            // TODO: make better concatenation
            this.ViewBag.OriginalPageUrl = VirtualPathUtility.AppendTrailingSlash(ampPageData.PageUrl) + locatableItem.UrlName.TrimStart('/');
        }
Exemplo n.º 2
0
        public void Delete(AmpPageDeleteRequest request)
        {
            var     ampManager = AMPManager.GetManager();
            AmpPage ampPage    = ampManager.GetAmpPage(request.Id);

            ampManager.DeleteAmpPage(ampPage);

            ampManager.SaveChanges();
        }
Exemplo n.º 3
0
 public void ToAmpPage(AmpPage ampPage)
 {
     ampPage.Title              = this.Title;
     ampPage.ItemType           = this.ItemType;
     ampPage.PageId             = this.PageId;
     ampPage.FieldsListJson     = JsonSerializer.SerializeToString <IList <AmpPageFieldDto> >(this.Fields);
     ampPage.UrlName            = this.UrlName;
     ampPage.LayoutTemplatePath = this.LayoutTemplatePath;
     ampPage.TemplatePath       = this.TemplatePath;
     ampPage.PageUrl            = this.PageUrl;
 }
        /// <summary>
        /// Creates a new AmpPages and returns it.
        /// </summary>
        /// <returns>The new AmpPages.</returns>
        public override AmpPage CreateAmpPage()
        {
            Guid id = Guid.NewGuid();

            var item = new AmpPage(id, this.ApplicationName);

            if (id != Guid.Empty)
            {
                this.GetContext().Add(item);
            }

            return(item);
        }
Exemplo n.º 5
0
        public AmpPageDto Post(AmpPageUpdateRequest request)
        {
            var ampPageDto = new AmpPageDto(request);

            var     ampManager = AMPManager.GetManager();
            AmpPage ampPage    = ampManager.GetAmpPage(ampPageDto.Id);

            ampPageDto.ToAmpPage(ampPage);

            ampManager.SaveChanges();

            ampPageDto = new AmpPageDto(ampPage);

            return(ampPageDto);
        }
Exemplo n.º 6
0
        public AmpPageDto Put(AmpPageInsertRequest request)
        {
            var ampPageDto = new AmpPageDto(request);

            var     ampManager = AMPManager.GetManager();
            AmpPage ampPage    = ampManager.CreateAmpPage();

            ampPageDto.ToAmpPage(ampPage);

            ampManager.SaveChanges();

            ampPageDto = new AmpPageDto(ampPage);

            return(ampPageDto);
        }
Exemplo n.º 7
0
        public AmpPageDto(AmpPage ampPage)
        {
            if (ampPage == null)
            {
                return;
            }

            this.Id                 = ampPage.Id;
            this.Title              = ampPage.Title;
            this.ItemType           = ampPage.ItemType;
            this.PageId             = ampPage.PageId;
            this.Fields             = JsonSerializer.DeserializeFromString <IList <AmpPageFieldDto> >(ampPage.FieldsListJson);
            this.UrlName            = ampPage.UrlName;
            this.TemplatePath       = ampPage.TemplatePath;
            this.LayoutTemplatePath = ampPage.LayoutTemplatePath;
            this.PageUrl            = ampPage.PageUrl;
        }
 /// <summary>
 /// Deletes the AmpPages.
 /// </summary>
 /// <param name="entity">The AmpPages entity.</param>
 public override void DeleteAmpPage(AmpPage entity)
 {
     this.GetContext().Remove(entity);
 }
 /// <summary>
 /// Updates the AmpPages.
 /// </summary>
 /// <param name="entity">The AmpPages entity.</param>
 public override void UpdateAmpPage(AmpPage entity)
 {
     entity.LastModified = DateTime.UtcNow;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Deletes the AmpPages.
 /// </summary>
 /// <param name="entity">The AmpPages entity.</param>
 public abstract void DeleteAmpPage(AmpPage entity);
Exemplo n.º 11
0
 /// <summary>
 /// Updates the AmpPages.
 /// </summary>
 /// <param name="entity">The AmpPages entity.</param>
 public abstract void UpdateAmpPage(AmpPage entity);
Exemplo n.º 12
0
 /// <summary>
 /// Deletes the AmpPages.
 /// </summary>
 /// <param name="entity">The AmpPages entity.</param>
 public void DeleteAmpPage(AmpPage entity)
 {
     this.Provider.DeleteAmpPage(entity);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Updates the AmpPages.
 /// </summary>
 /// <param name="entity">The AmpPages entity.</param>
 public void UpdateAmpPage(AmpPage entity)
 {
     this.Provider.UpdateAmpPage(entity);
 }