internal Attachment(IJsonAttachment json, string ownerId, TrelloAuthorization auth) { Id = json.Id; _context = new AttachmentContext(Id, ownerId, auth); _context.Synchronized.Add(this); _bytes = new Field <int?>(_context, nameof(Bytes)); _date = new Field <DateTime?>(_context, nameof(Date)); _member = new Field <Member>(_context, nameof(Member)); _edgeColor = new Field <WebColor>(_context, nameof(EdgeColor)); _isUpload = new Field <bool?>(_context, nameof(IsUpload)); _mimeType = new Field <string>(_context, nameof(MimeType)); _name = new Field <string>(_context, nameof(Name)); _name.AddRule(NotNullOrWhiteSpaceRule.Instance); _position = new Field <Position>(_context, nameof(Position)); _position.AddRule(PositionRule.Instance); _url = new Field <string>(_context, nameof(Url)); if (auth != TrelloAuthorization.Null) { TrelloConfiguration.Cache.Add(this); } _context.Merge(json); }
public OperationResult Delete(int id) { OperationResult operationResult = new OperationResult(); try { Attachment attachment = GetAttachment(id); if (attachment != null) { AttachmentContext db = new AttachmentContext(); db.Entry(attachment).State = EntityState.Deleted; db.SaveChanges(); operationResult.Success = true; operationResult.Message = "Attachment Deleted Successfully"; } else { operationResult.Success = false; operationResult.Message = "Attachment not found"; } } catch (Exception ex) { operationResult.Success = false; operationResult.Message = "An Error Ocured During Deleting the Attachment"; } return(operationResult); }
public TransactionBehaviour(AttachmentContext dbContext, IAttachmentIntegrationEventService orderingIntegrationEventService, ILogger <TransactionBehaviour <TRequest, TResponse> > logger) { _dbContext = dbContext ?? throw new ArgumentException(nameof(AttachmentContext)); _orderingIntegrationEventService = orderingIntegrationEventService ?? throw new ArgumentException(nameof(orderingIntegrationEventService)); _logger = logger ?? throw new ArgumentException(nameof(ILogger)); }
public AttachmentIntegrationEventService(IEventBus eventBus, AttachmentContext attachmentContext, IntegrationEventLogContext eventLogContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory) { _attachmentContext = attachmentContext ?? throw new ArgumentNullException(nameof(attachmentContext)); _eventLogContext = eventLogContext ?? throw new ArgumentNullException(nameof(eventLogContext)); _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); _eventLogService = _integrationEventLogServiceFactory(_attachmentContext.Database.GetDbConnection()); }
public static void SetAttachmentContext(this ExecutionOptions options, AttachmentContext attachmentContext) { if (options.UserContext == null) { options.UserContext = new Dictionary <string, object> { { key, attachmentContext } }; return; } UserContextAsDictionary(options.UserContext).Add(key, attachmentContext); }
public AttachmentContext GetAttachment() { var fa = WrappedNakedObject.Object as FileAttachment; var context = new AttachmentContext(); if (fa != null) { context.Content = fa.GetResourceAsStream(); context.MimeType = fa.MimeType; context.ContentDisposition = fa.DispositionType; context.FileName = fa.Name; } return(context); }
internal Attachment(IJsonAttachment json, string ownerId, TrelloAuthorization auth) { Id = json.Id; _context = new AttachmentContext(Id, ownerId, auth); _context.Synchronized += Synchronized; _bytes = new Field <int?>(_context, nameof(Bytes)); _date = new Field <DateTime?>(_context, nameof(Date)); _member = new Field <Member>(_context, nameof(Member)); _isUpload = new Field <bool?>(_context, nameof(IsUpload)); _mimeType = new Field <string>(_context, nameof(MimeType)); _name = new Field <string>(_context, nameof(Name)); Previews = new ReadOnlyAttachmentPreviewCollection(_context, auth); _url = new Field <string>(_context, nameof(Url)); TrelloConfiguration.Cache.Add(this); _context.Merge(json); }
public OperationResult SaveAttachments(List <Attachment> NewAttachments) { OperationResult operationResult = new OperationResult(); try { AttachmentContext db = new AttachmentContext(); db.Attachments.AddRange(NewAttachments); db.SaveChanges(); operationResult.Success = true; operationResult.Message = "Attachments Added Successfully"; } catch (Exception ex) { operationResult.Success = false; operationResult.Message = "An Error Ocured During saving the new Attachments "; } return(operationResult); }
public AttachmentController(AttachmentContext context, IConfiguration config, ILiteXBlobServiceAsync provider) { _context = context; _fileSizeLimit = config.GetValue <long>("FileSizeLimit"); _provider = provider; }
public AttachmentService(IAmazonS3 client, AttachmentContext attachmentContext) { _client = client; _attachmentContext = attachmentContext; }
public AttachmentController(AttachmentContext attachmentContext) { _attachmentContext = attachmentContext; }
public AttachmentRepository(AttachmentContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public RequestManager(AttachmentContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public Task SeedAsync(AttachmentContext context, IHostingEnvironment env, IOptions <AttachmentSettings> settings, ILogger <AttachmentContextSeed> logger) { // See https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs for // an example of seeding the DB from a csv file throw new NotImplementedException(); }
public RemoveAttachmentCommand(MailCompositionContext context, AttachmentContext attachmentContext) { _context = context; _attachmentContext = attachmentContext; }
internal ReadOnlyAttachmentPreviewCollection(AttachmentContext context, TrelloAuthorization auth) : base(() => context.Data.Id, auth) { _context = context; }
public static void SetAttachmentContext(this ExecutionOptions options, AttachmentContext attachmentContext) { UserContextAsDictionary(options.UserContext).Add(key, attachmentContext); }
public Attachment GetAttachment(int id) { AttachmentContext db = new AttachmentContext(); return(db.Attachments.FirstOrDefault(attachment => attachment.ID == id)); }
public List <Attachment> GetAllAttachments() { AttachmentContext db = new AttachmentContext(); return(db.Attachments.AsNoTracking().ToList()); }