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 }); }
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()); }
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)); }