public async Task <UnitOfMeasure> AddUnitOfMeasureAsync(UnitOfMeasure unitOfMeasure)
        {
            _context.Create(unitOfMeasure);
            await _context.CommitAsync();

            return(unitOfMeasure);
        }
예제 #2
0
        public async Task <StockType> AddStockTypeAsync(StockType stockType)
        {
            _context.Create(stockType);
            await _context.CommitAsync();

            return(stockType);
        }
예제 #3
0
        public async Task <TransactionType> AddTransactionTypeAsync(TransactionType transactionType)
        {
            _context.Create(transactionType);
            await _context.CommitAsync();

            return(transactionType);
        }
예제 #4
0
        public async Task <ServiceType> AddServiceTypeAsync(ServiceType serviceType)
        {
            _context.Create(serviceType);
            await _context.CommitAsync();

            return(serviceType);
        }
예제 #5
0
        public async Task <PaymentType> AddPaymentTypeAsync(PaymentType paymentType)
        {
            _context.Create(paymentType);
            await _context.CommitAsync();

            return(paymentType);
        }
예제 #6
0
        public async Task <Supplier> AddSupplierAsync(Supplier supplier)
        {
            _context.Create(supplier);
            await _context.CommitAsync();

            return(supplier);
        }
예제 #7
0
        public async Task <StockItem> AddStockItemAsync(StockItem stockItem)
        {
            _context.Create(stockItem);
            await _context.CommitAsync();

            return(await _context.StockItems
                   .Include(p => p.Type)
                   .Include(p => p.UnitOfMeasure)
                   .FirstAsync(e => e.Id == stockItem.Id));
        }
예제 #8
0
        public async Task <PurchaseOrderItem> AddPurchaseOrderItemAsync(PurchaseOrderItem orderItem)
        {
            _context.Create(orderItem);
            await _context.CommitAsync();

            return(await _context.PurchaseOrderItems
                   .Include(p => p.PurchaseOrder)
                   .Include(p => p.Item)
                   .FirstAsync(e => e.Id == orderItem.Id));
        }
예제 #9
0
        public async Task <GoodsReceivedNoteItem> AddGoodsReceivedNoteItemAsync(GoodsReceivedNoteItem goodsReceivedNoteItem)
        {
            _context.Create(goodsReceivedNoteItem);
            await _context.CommitAsync();

            return(await _context.GoodsReceivedNoteItems
                   .Include(p => p.Item)
                   .Include(p => p.GoodsReceivedNote)
                   .FirstAsync(e => e.Id == goodsReceivedNoteItem.Id));
        }
예제 #10
0
        public async Task <Transaction> AddTransactionAsync(Transaction transaction)
        {
            _context.Create(transaction);
            await _context.CommitAsync();

            return(await _context.Transactions
                   .Include(p => p.TransactionType)
                   .Include(p => p.PaymentType)
                   .FirstAsync(e => e.Id == transaction.Id));
        }
예제 #11
0
        public async Task <PurchaseOrder> AddPurchaseOrderAsync(PurchaseOrder order)
        {
            _context.Create(order);
            await _context.CommitAsync();

            return(await _context.PurchaseOrders
                   .Include(p => p.Supplier)
                   .Include(p => p.RequestedUser)
                   .FirstAsync(e => e.Id == order.Id));
        }
        public async Task <GoodsReceivedNote> AddGoodsReceivedNoteAsync(GoodsReceivedNote goodsReceivedNote)
        {
            _context.Create(goodsReceivedNote);
            await _context.CommitAsync();

            return(await _context.GoodsReceivedNotes
                   .Include(p => p.PaymentType)
                   .Include(p => p.PurchaseOrder)
                   .Include(p => p.ReceivedUser)
                   .FirstAsync(e => e.Id == goodsReceivedNote.Id));
        }
예제 #13
0
        public async Task <RefreshToken> GenerateRefreshToken(Guid userId, string ipAddress)
        {
            var token = GenerateToken(_jwtSettings.RefreshTokenSecret,
                                      _jwtSettings.Issuer,
                                      _jwtSettings.Audience,
                                      _jwtSettings.RefreshTokenExpirationInMinutes,
                                      claims: null);

            var refreshToken = new RefreshToken
            {
                Token       = token,
                UserId      = userId,
                Expires     = DateTime.UtcNow.AddMinutes(_jwtSettings.RefreshTokenExpirationInMinutes),
                Created     = DateTime.UtcNow,
                CreatedByIp = ipAddress
            };

            _context.Create(refreshToken);
            await _context.CommitAsync();

            return(refreshToken);
        }