public void CreateVoucher()
        {
            var voucherController = _container.Resolve<VoucherController>();
            var customerController = _container.Resolve<CustomerController>();

            var customersIndexView = customerController.Index() as ViewResult;
            var customers = ((List<Customer>)customersIndexView.Model);

            var model = new CreateVoucherViewModel()
            {
                CustomerId = customers[0].Id,
                Amount = 10m
            };

            var result = voucherController.Create(model) as RedirectToRouteResult;
        }
        public ActionResult Create(CreateVoucherViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            using (ITransaction transaction = _session.BeginTransaction())
            {
                var voucher = Voucher.CreateVoucher(model.CustomerId, new Money(model.Amount), _codeGenerator);

                _voucherRepository.Add(voucher);

                transaction.Commit();
            }

            return RedirectToAction("Index");
        }