예제 #1
0
파일: ItemBase.cs 프로젝트: 9lindt/Itemify
        internal ItemEntity GetEntity()
        {
            if (subTypes != null)
            {
                entity.SubTypes = subTypes.ToStringValue();
            }

            entity.ParentGuid = parent.Guid;
            entity.ParentType = parent.Type.ToStringValue();

            var now = DateTime.Now;

            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerMillisecond)); // cut off ticks

            if (entity.Created == DateTime.MinValue)
            {
                entity.Revision = 0;
                entity.Created  = now;
            }
            else
            {
                entity.Revision++;
            }

            entity.Modified = now;

            return(entity);
        }