示例#1
0
        public async Task <int> NewExpensesAsync(Domain.Expense expense)
        {
            var result = -1;

            try
            {
                _expContext.Add(expense);
                result = await _expContext.SaveChangesAsync();

                if (result < 1)
                {
                    throw new Exception("Error occurred while adding new expense into database");
                }
                result = expense.Id;
            }
            catch (Exception)
            {
                throw;
            }

            return(result);
        }