示例#1
0
        public ActionResult CompleteJob(string jobId)
        {
            var          model   = new CompleteJobViewModel();
            LogicService cmLogic = new LogicService();

            //Generate list of expenses to display
            var matchingExpenseAssignments            = cmLogic.GetAllExpenseAssignmentsForJob(jobId);
            List <ExpenseViewModel> expensesToDisplay = new List <ExpenseViewModel>();

            foreach (JobExpenseDTO ea in matchingExpenseAssignments)
            {
                ExpenseViewModel expense = new ExpenseViewModel();
                expense.ExpenseName = ea.Expense.Name;
                expense.ExpenseCost = ea.Expense.Cost.ToString();

                expensesToDisplay.Add(expense);
            }

            model.AllExpensesForJob = expensesToDisplay;

            //Pass in job id from URL
            model.JobId = jobId;

            return(View(model));
        }