public async Task <ConversationDto> UpdateAsync(int id, ConversationUpdateDto updateDto) { ConversationDto conversationDto; int oldMaxLogId; using (var uow = UnitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) { Conversation conversation = _conversationService.CheckIfExists(id); oldMaxLogId = conversation.Logs.Select(t => t.Id).DefaultIfEmpty().Max(); Mapper.Map(updateDto, conversation); _conversationService.UpdateAndWriteLog(conversation); conversationDto = Mapper.Map <ConversationDto>(conversation); FillFields(conversationDto); uow.Complete(); } await _notificationManager.NotifyUpdateConversation(CurrentUnitOfWork.GetSiteId().GetValueOrDefault(), id, oldMaxLogId); return(conversationDto); }
public async Task <ConversationDto> PutConversation(int id, ConversationUpdateDto createDto) { createDto = createDto ?? new ConversationUpdateDto(); return(await _conversationAppService.UpdateAsync(id, createDto)); }