Example #1
0
        public async Task <IActionResult> UpdateStory([FromRoute] Guid organizationId, [FromRoute] Guid storyId,
                                                      [FromBody] UpdateStoryInput model)
        {
            var story = await _storyService.UpdateStory(_accountManager, storyId, model);

            return(Ok(story));
        }
        private async Task <StoryResult> UpdateStoryInternal(Guid storyId, UpdateStoryInput input)
        {
            var retVal = new StoryResult {
                StoryId = storyId
            };

            var entity = await Repository
                         .FirstOrDefaultAsync(x => x.Id == storyId);

            entity.InjectFrom(input);

            entity.Updated     = DateTimeOffset.UtcNow;
            entity.ObjectState = ObjectState.Modified;

            var records = await Repository.UpdateAsync(entity, true);

            _logger.LogDebug(GetLogMessage("{0} Records updated"), records);


            if (records > 0)
            {
                retVal.Succeeded = true;
                await Task.Run(() =>
                {
                    RaiseEvent(new StoryUpdatedEvent
                    {
                        StoryId = storyId
                    });
                });
            }

            return(retVal);
        }
 public Task <StoryResult> UpdateStory(IOrganizationContractor co,
                                       Guid storyId,
                                       UpdateStoryInput model)
 {
     return(UpdateStoryInternal(storyId, model));
 }
 public Task <StoryResult> UpdateStory(IOrganizationProjectManager pm,
                                       Guid storyId,
                                       UpdateStoryInput model)
 {
     return(UpdateStoryInternal(storyId, model));
 }
 public Task <StoryResult> UpdateStory(IProviderAgencyOwner agencyOwner,
                                       Guid storyId,
                                       UpdateStoryInput model)
 {
     return(UpdateStoryInternal(storyId, model));
 }