Esempio n. 1
0
        public int SaveAttachment(Attachment attachmentToCreate)
        {
            _attachmentContext.Add(attachmentToCreate);
            int response = _attachmentContext.SaveChanges();

            return(response);
        }
        public async Task CreateRequestForCommandAsync <T>(Guid id)
        {
            var exists = await ExistAsync(id);

            var request = exists ?
                          throw new AttachmentDomainException($"Request with {id} already exists") :
                                new ClientRequest()
                                {
                                    Id   = id,
                                    Name = typeof(T).Name,
                                    Time = DateTime.UtcNow
                                };

            _context.Add(request);

            await _context.SaveChangesAsync();
        }