private async Task <Notification> Create(Protocols.Common.NotificationCreate notification) { try { var sourceId = await GetSourceId(notification.CrawlingType, notification.BoardName); return(await _mongoDbNotification.UpsertAsync(GetFilterDefinition(sourceId, notification.CrawlingType, notification.Type), notification.ToModel(sourceId))); } catch (MongoWriteException) { throw new DeveloperException(ResultCode.UsingNotificationId); } }
private async Task <Notification> Create(Protocols.Common.NotificationCreate notification) { try { return(await _mongoDbNotification.UpsertAsync(Builders <Notification> .Filter.Eq(x => x.Region, notification.Region), notification.ToModel())); } catch (MongoWriteException) { throw new DeveloperException(Code.ResultCode.UsingNotificationId); } }