Пример #1
0
        public async Task <bool> StoreNewNoteAsync(int CustomerId, Note Note)
        {
            Note.CustomerId = CustomerId;

            _context.Notes.Add(Note);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #2
0
        public async Task <bool> StoreNewEstimateAsync(int InvoiceId, Estimate Estimate)
        {
            Estimate.InvoiceId = InvoiceId;

            _context.Estimates.Add(Estimate);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task <bool> StoreNewPaymentDetailsAsync(int AccountId, PaymentDetails PaymentDetails)
        {
            PaymentDetails.AccountId = AccountId;

            _context.PaymentDetails.Add(PaymentDetails);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #4
0
        public async Task <bool> StoreNewExpenseLineAsync(int ExpenseId, ExpenseLine ExpenseLine)
        {
            ExpenseLine.ExpenseId = ExpenseId;

            _context.ExpenseLines.Add(ExpenseLine);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #5
0
        public async Task <bool> StoreNewAddressAsync(int CustomerId, Address Address)
        {
            Address.CustomerId = CustomerId;

            _context.Addresses.Add(Address);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task <bool> StoreNewSalesReceiptLineAsync(int SalesReceiptId, SalesReceiptLine SalesReceiptLine)
        {
            SalesReceiptLine.SalesReceiptId = SalesReceiptId;

            _context.SalesReceiptLines.Add(SalesReceiptLine);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #7
0
        public async Task <bool> StoreNewPayAsync(int EmployeeId, Pay Pay)
        {
            Pay.EmployeeId = EmployeeId;

            _context.Pays.Add(Pay);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #8
0
        public async Task <bool> StoreNewTaxInfoAsync(int CustomerId, TaxInfo TaxInfo)
        {
            TaxInfo.CustomerId = CustomerId;

            _context.TaxInfos.Add(TaxInfo);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task <bool> StoreNewCreditNoteLineAsync(int CreditNoteId, CreditNoteLine CreditNoteLine)
        {
            CreditNoteLine.CreditNoteId = CreditNoteId;

            _context.CreditNoteLines.Add(CreditNoteLine);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #10
0
        public async Task <bool> StoreNewTrainingAsync(int EmployeeId, Training Training)
        {
            Training.EmployeeId = EmployeeId;

            _context.Trainings.Add(Training);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #11
0
        public async Task <bool> StoreNewDelayedChargeLineAsync(int DelayedChargeId, DelayedChargeLine DelayedChargeLine)
        {
            DelayedChargeLine.DelayedChargeId = DelayedChargeId;

            _context.DelayedChargeLines.Add(DelayedChargeLine);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #12
0
        public async Task Create(Income inputIncome)
        {
            if (!context.Accounts.Any(x => x.Id == inputIncome.AccountId))
            {
                throw new ArgumentNullException("Account does note exist.");
            }

            var income = context.Incomes
                         .Where(x => x.Id == inputIncome.Id)
                         .SingleOrDefault();

            if (income != null)
            {
                throw new ArgumentException("Income already exists.");
            }

            if (!context.Categories.Any(x => x.Id == inputIncome.CategoryId))
            {
                throw new ArgumentException("Category does not exist.");
            }

            inputIncome.Id = Guid.NewGuid().ToString();
            await context.Incomes.AddAsync(inputIncome);

            await context.SaveChangesAsync();
        }
Пример #13
0
        public async Task <bool> StoreNewEquipmentAsync(int EmployeeId, Equipment Equipment)
        {
            Equipment.EmployeeId = EmployeeId;

            _context.Equipments.Add(Equipment);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task <bool> StoreNewDelayedChargeAsync(int InvoiceId, DelayedCharge DelayedCharge)
        {
            DelayedCharge.InvoiceId = InvoiceId;

            _context.DelayedCharges.Add(DelayedCharge);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #15
0
        public async Task <bool> StoreNewInvoiceLineAsync(int InvoiceId, InvoiceLine InvoiceLine)
        {
            InvoiceLine.InvoiceId = InvoiceId;

            _context.InvoiceLines.Add(InvoiceLine);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #16
0
        public async Task <bool> StoreNewPaymentAsync(int InvoiceId, Payment Payment)
        {
            Payment.InvoiceId = InvoiceId;

            _context.Payments.Add(Payment);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #17
0
        public async Task <bool> StoreNewEstimateLineAsync(int EstimateId, EstimateLine EstimateLine)
        {
            EstimateLine.EstimateId = EstimateId;

            _context.EstimateLines.Add(EstimateLine);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #18
0
        public async Task <bool> StoreNewBankAccountAsync(int CustomerId, BankAccount BankAccount)
        {
            BankAccount.CustomerId = CustomerId;

            _context.BankAccounts.Add(BankAccount);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #19
0
        public async Task <bool> StoreNewAbsenceAsync(int EmployeeId, Absence Absence)
        {
            Absence.EmployeeId = EmployeeId;

            _context.Absences.Add(Absence);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task<bool> StoreNewTaxInformationAsync(int EmployeeId, TaxInformation TaxInformation)
        {
            TaxInformation.EmployeeId = EmployeeId;

            _context.TaxInformations.Add(TaxInformation);
            return (await _context.SaveChangesAsync()) > 0;
        }
Пример #21
0
        public async Task <bool> StoreNewPaymentBillingAsync(int CustomerId, PaymentBilling PaymentBilling)
        {
            PaymentBilling.CustomerId = CustomerId;

            _context.PaymentBillings.Add(PaymentBilling);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task <bool> StoreNewSupplierNoteAsync(int SupplierId, SupplierNote SupplierNote)
        {
            SupplierNote.SupplierId = SupplierId;

            _context.SupplierNotes.Add(SupplierNote);
            return((await _context.SaveChangesAsync()) > 0);
        }
        public async Task <bool> StoreNewSubscriptionAsync(int AccountId, Subscription Subscription)
        {
            Subscription.AccountId = AccountId;

            _context.Subscriptions.Add(Subscription);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #24
0
        public async Task <bool> StoreNewAttachmentAsync(int SupplierId, Attachment Attachment)
        {
            Attachment.SupplierId = SupplierId;

            _context.Attachments.Add(Attachment);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #25
0
        public async Task <bool> StoreNewSalesReceiptAsync(int InvoiceId, SalesReceipt SalesReceipt)
        {
            SalesReceipt.InvoiceId = InvoiceId;

            _context.SalesReceipts.Add(SalesReceipt);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #26
0
        public async Task <bool> StoreNewHolidayAsync(int EmployeeId, Holiday Holiday)
        {
            Holiday.EmployeeId = EmployeeId;

            _context.Holidays.Add(Holiday);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #27
0
        public async Task <bool> StoreNewVoucherAsync(int AccountId, Voucher Voucher)
        {
            Voucher.AccountId = AccountId;

            _context.Vouchers.Add(Voucher);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #28
0
        public async Task <bool> StoreNewCreditNoteAsync(int InvoiceId, CreditNote CreditNote)
        {
            CreditNote.InvoiceId = InvoiceId;

            _context.CreditNotes.Add(CreditNote);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #29
0
        public async Task <bool> StoreNewCustomerAsync(Customer customer)
        {
            if (customer.AccountId <= 0)
            {
                customer.AccountId = 1987; //Would normally be taken of users account, but this is a demo this will do!
            }

            _context.Customers.Add(customer);
            return((await _context.SaveChangesAsync()) > 0);
        }
Пример #30
0
        public async Task Create(Expense inputExpense, byte[] image)
        {
            if (!context.Accounts.Any(x => x.Id == inputExpense.AccountId))
            {
                throw new ArgumentNullException("Account does note exist.");
            }

            //var imageUrl = await cloudService.Upload(image, inputExpense.ImageName);

            inputExpense.Id = Guid.NewGuid().ToString();

            context.Expenses.Add(inputExpense);
            await context.SaveChangesAsync();
        }