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('/'); }
public void Delete(AmpPageDeleteRequest request) { var ampManager = AMPManager.GetManager(); AmpPage ampPage = ampManager.GetAmpPage(request.Id); ampManager.DeleteAmpPage(ampPage); ampManager.SaveChanges(); }
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); }
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); }
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); }
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; }
/// <summary> /// Deletes the AmpPages. /// </summary> /// <param name="entity">The AmpPages entity.</param> public abstract void DeleteAmpPage(AmpPage entity);
/// <summary> /// Updates the AmpPages. /// </summary> /// <param name="entity">The AmpPages entity.</param> public abstract void UpdateAmpPage(AmpPage entity);
/// <summary> /// Deletes the AmpPages. /// </summary> /// <param name="entity">The AmpPages entity.</param> public void DeleteAmpPage(AmpPage entity) { this.Provider.DeleteAmpPage(entity); }
/// <summary> /// Updates the AmpPages. /// </summary> /// <param name="entity">The AmpPages entity.</param> public void UpdateAmpPage(AmpPage entity) { this.Provider.UpdateAmpPage(entity); }