Exemple #1
0
        public async Task <InvoiceItemOrDiscount> CreateAsync(InvoiceItemOrDiscount obj, bool saveChange = true)
        {
            var item = new InvoiceItemOrDiscount
            {
                Id               = Guid.NewGuid().ToString(),
                CreationDate     = DateTime.Now.ToString(),
                Creator          = "Tam",
                FkInvoice        = obj.FkInvoice,
                FkItemOrDiscount = obj.FkItemOrDiscount,
                IsDeleted        = (int)IsDelete.Normal,
                Quantity         = obj.Quantity,
                IsDiscount       = obj.IsDiscount,
                Value            = obj.Value
            };

            _DbContext.InvoiceItemOrDiscount.Add(item);

            try
            {
                if (saveChange)
                {
                    await _DbContext.SaveChangesAsync().ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(item);
        }
Exemple #2
0
        public async Task <InvoiceItemOrDiscount> UpdateAsync(InvoiceItemOrDiscount obj, bool saveChange = true)
        {
            var item = await _DbContext.InvoiceItemOrDiscount.FirstOrDefaultAsync(h => h.Id == obj.Id);

            try
            {
                if (saveChange)
                {
                    await _DbContext.SaveChangesAsync().ConfigureAwait(false);
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(item);
        }
Exemple #3
0
 public async Task SendInvoiceItem(InvoiceItemOrDiscount invoiceItem)
 {
     await Clients.Others.SendAsync("ReceiveInvoiceItem", invoiceItem);
 }