| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using GreenTree.Nachtragsmanagement.Core.Domain.Misc;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
- {
- public class HelpPageDataModel
- {
- public int Id { get; set; }
- public string Title { get; set; }
- public int? ParentId { get; set; }
- public string ParentText { get; set; }
- public string Content { get; set; }
- public int DisplayIndex { get; set; }
- public HelpPageDataModel()
- {
- }
- public static HelpPageDataModel FromHelpPage(Core.Domain.Misc.HelpPage helpPageEntity, bool newWhenIsNull)
- {
- if (helpPageEntity == null && newWhenIsNull)
- return new HelpPageDataModel
- {
- Id = -1,
- };
- if (helpPageEntity == null && !newWhenIsNull)
- throw new ArgumentNullException("helpPageEntity", "Cannot create HelpPageDataModel from NULL helpPage entity.");
- var helpPageDataModel = new HelpPageDataModel
- {
- Id = helpPageEntity.Id,
- Title = helpPageEntity.Title,
- ParentId = helpPageEntity.ParentId,
- ParentText = helpPageEntity.Parent == null
- ? String.Empty
- : helpPageEntity.Parent.Title,
- Content = helpPageEntity.Content,
- DisplayIndex = helpPageEntity.DisplayIndex
- };
- return helpPageDataModel;
- }
- public Core.Domain.Misc.HelpPage ToHelpPage()
- {
- return new Core.Domain.Misc.HelpPage
- {
- Id = this.Id,
- Title = this.Title,
- ParentId = this.ParentId,
- Content = this.Content,
- DisplayIndex = this.DisplayIndex
- };
- }
- }
- }
|