// GET: Expense/Manage
        public ActionResult Manage(int id=0)
        {
            var manageVM = new ManageExpenseVM
            {
                Customers = customerService.GetAllCustomers().Select(a => new SelectListItem
                {
                    Text = a.Name,
                    Value = a.Id.ToString()
                }),
                Projects = new List<SelectListItem>()
            };

            if (id > 0)
            {
                var expense = expenseService.GetExpenseById(id);
                manageVM.Id = expense.Id;
                manageVM.Amount = expense.Amount;
                manageVM.ProjectId = expense.ProjectId;
                manageVM.Description = expense.Description;
                manageVM.Notes = expense.Notes;
                manageVM.ExpenseDate = expense.ExpenseDate;
                manageVM.ExpenseName = expense.Name;

                manageVM.CustomerId = projectService.GetAllProjects()
                        .Where(p => p.Id == expense.ProjectId)
                        .Select(p => p.CustomerId)
                        .FirstOrDefault();
                manageVM.Projects = projectService.GetAllProjects().Where(p=>p.CustomerId == manageVM.CustomerId).Select(a => new SelectListItem
                {
                    Text = a.Name,
                    Value = a.Id.ToString()
                });
                return View("Edit", manageVM);
            }
            return View("Create",manageVM);
        }
        public ActionResult Manage(ManageExpenseVM modelVm)
        {
            try
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        var modelDto = new ExpenseDto
                        {
                            Id = modelVm.Id,
                            ProjectId = modelVm.ProjectId,
                            Description = modelVm.Description,
                            Amount = modelVm.Amount,
                            ExpenseDate = modelVm.ExpenseDate,
                            Name = modelVm.ExpenseName,
                            Notes = modelVm.Notes
                        };

                        if (modelVm.Id > 0)
                        {
                            expenseService.UpdateExpense(modelDto);
                        }
                        else
                        {
                            expenseService.AddExpense(modelDto);

                        }
                    }

                }
                catch (Exception)
                {
                    ///TODO:Add exception handler
                    throw;
                }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }