public async Task ImportImageAsync(Guid eventId, string imagePath, PurposeEnum imagePurpose) { var @event = await _eventService.FindOneAsync(eventId); if (@event == null) { throw new ArgumentException("Event does not exist", nameof(eventId)); } if (!File.Exists(imagePath)) { throw new ArgumentException("File does not exist", nameof(imagePath)); } var imageTag = $"event:{imagePurpose}:{eventId}"; var imageContent = File.ReadAllBytes(imagePath); var imageId = await _imageService.InsertOrUpdateImageAsync(imageTag, imageContent); switch (imagePurpose) { case PurposeEnum.Banner: @event.BannerImageId = imageId; break; case PurposeEnum.Poster: @event.PosterImageId = imageId; break; } @event.Touch(); await _eventService.ReplaceOneAsync(@event); await Task.Delay(0); }
public ConsentDetails(PurposeEnum purpose, bool recurring, Uri redirectUri = null, DateTime?validUntil = null, int?accessFrequency = null, bool?combined = null) { this.ConsentPurpose = purpose; this.Recurring = recurring; this.ValidUntil = validUntil; this.AccessFrequency = accessFrequency; this.Combined = combined; }
internal IEnumerable <(string IBAN, string BBAN, string MSISDN)> GetAccountReferencesFor(PurposeEnum purpose) { var foundAccounts = new List <(string IBAN, string BBAN, string MSISDN)>(); if (this.IBAN != null) { foreach (var iban in this.IBAN.Where(reference => (reference.Purpose & purpose) == purpose)) { foundAccounts.Add((iban.Reference, null, null)); } } if (this.BBAN != null) { foreach (var bban in this.BBAN.Where(reference => (reference.Purpose & purpose) == purpose)) { foundAccounts.Add((null, bban.Reference, null)); } } if (this.MSISDN != null) { foreach (var msisdn in this.MSISDN.Where(reference => (reference.Purpose & purpose) == purpose)) { foundAccounts.Add((null, null, msisdn.Reference)); } } return(foundAccounts); }