예제 #1
0
 private static Detail CreateEntity(Guid memoryBookUniverseId, DetailCreateModel model)
 {
     return(new Detail
     {
         CreatorId = model.CreatorId,
         CustomDetailText = model.CustomDetailText,
         DetailTypeId = model.DetailTypeId,
         Story = model.Story,
         StartTime = model.StartTime,
         EndTime = model.EndTime
     });
 }
예제 #2
0
        private async Task <DetailReadModel> CreateDetail(Guid memoryBookUniverseId, DetailCreateModel detailCreateModel)
        {
            Contract.RequiresNotNull(detailCreateModel, nameof(detailCreateModel));

            var id = await this.detailCommandManager.CreateDetails(memoryBookUniverseId, detailCreateModel)
                     .ConfigureAwait(false);

            if (id == null || id.Count == 0)
            {
                return(null);
            }

            var detailReadModels = await this.detailQueryManager.GetDetails(memoryBookUniverseId, id)
                                   .ConfigureAwait(false);

            return(detailReadModels.FirstOrDefault());
        }
예제 #3
0
        public async Task <DetailReadModel> CreateDetail(Guid memoryBookUniverseId, MemberReadModel creator, string customDetailText, DetailTypeEnum detailType, DateTime?startDate, DateTime?endDate = null)
        {
            Contract.RequiresNotNull(creator, nameof(creator));

            var detailTypeReadModel = await this.GetDetailType(detailType).ConfigureAwait(false);

            DetailCreateModel detailCreateModel = new DetailCreateModel
            {
                StartTime        = startDate,
                EndTime          = endDate,
                CreatorId        = creator.Id,
                CustomDetailText = customDetailText,
                DetailTypeId     = detailTypeReadModel.Id
            };

            return(await this.CreateDetail(memoryBookUniverseId, detailCreateModel)
                   .ConfigureAwait(false));
        }