protected async Task HandleValidSubmit()
        {
            Expense.EmployeeId = int.Parse(EmployeeId);
            Expense.CurrencyId = int.Parse(CurrencyId);



            Expense.Amount *= Currencies.FirstOrDefault(x => x.CurrencyId == Expense.CurrencyId).USExchange;

            // We can handle certain requests automatically
            Expense.Status = await ExpenseApprovalService.GetExpenseStatus(Expense);

            if (Expense.ExpenseId == 0) // New
            {
                await ExpenseService.AddExpense(Expense);

                NavigationManager.NavigateTo("/expenses");
            }
            else
            {
                await ExpenseService.UpdateExpense(Expense);

                NavigationManager.NavigateTo("/expenses");
            }
        }
        protected async Task HandleValidSubmit()
        {
            Expense.EmployeeId = int.Parse(EmployeeId);
            Expense.CurrencyId = int.Parse(CurrencyId);


            Expense.Amount *= Currencies.FirstOrDefault(x => x.CurrencyId == Expense.CurrencyId).USExchange;

            Expense.Status = await ExpenseApprovalService.GetExpenseStatus(Expense);

            if (Expense.ExpenseType == ExpenseType.Food && Expense.Amount > 100)
            {
                Expense.Status = ExpenseStatus.Pending;
            }

            if (Expense.Amount > 5000)
            {
                Expense.Status = ExpenseStatus.Pending;
            }

            if (Expense.ExpenseId == 0) // New
            {
                await ExpenseService.AddExpense(Expense);

                NavigationManager.NavigateTo("/expenses");
            }
            else
            {
                await ExpenseService.UpdateExpense(Expense);

                NavigationManager.NavigateTo("/expenses");
            }
        }
示例#3
0
        protected async Task HandleValidSubmit()
        {
            Expense.EmployeeId = int.Parse(EmployeeId);
            Expense.CurrencyId = int.Parse(CurrencyId);

            // We can deny certain expenses automatically
            Expense.Status = await ExpenseApprovalService.GetExpenseStatus(Expense);

            if (Expense.ExpenseId == 0) // New
            {
                await ExpenseDataService.AddExpense(Expense);

                NavigationManager.NavigateTo("/expenses");
            }
            else
            {
                await ExpenseDataService.UpdateExpense(Expense);

                NavigationManager.NavigateTo("/expenses");
            }
        }