Пример #1
0
        public async Task <int> Save(Transaction transaction)
        {
            try
            {
                ValidateFieldsEmpty(transaction);
                transaction.Id = Guid.NewGuid().ToString();
                _context.Transaction.Add(transaction);
                int result = await _context.SaveChangesAsync();

                return(result);
            }
            catch (DbException e)
            {
                throw e;
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }
Пример #2
0
        public async Task <int> Save(Categorie categorie)
        {
            try
            {
                ValidateFieldsEmpty(categorie);
                categorie.Id = System.Guid.NewGuid().ToString();
                _context.Categorie.Add(categorie);
                int result = await _context.SaveChangesAsync();

                return(result);
            }
            catch (DbException e)
            {
                throw e;
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }