Exemplo n.º 1
0
        public IActionResult Cancel()
        {
            var viewModel = BillPaySessionKey.GetEditViewModelFromSession(HttpContext.Session);

            if (viewModel.BillPayEditOp == BillPayEditOp.Create)
            {
                return(RedirectToAction("Create", "BillPay"));
            }
            return(RedirectToAction("Edit", "BillPay"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index([FromForm] int payeeID)
        {
            var payee = await PMgr.GetPayeeAsync(payeeID);

            var viewModel = BillPaySessionKey.GetEditViewModelFromSession(HttpContext.Session);

            viewModel.Payee = payee;
            BillPaySessionKey.SetEditViewModelToSession(viewModel, HttpContext.Session);

            if (viewModel.BillPayEditOp == BillPayEditOp.Create)
            {
                return(RedirectToAction("Create", "BillPay"));
            }
            return(RedirectToAction("Edit", "BillPay"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create()
        {
            var viewModel = BillPaySessionKey.GetEditViewModelFromSession(HttpContext.Session);

            if (viewModel == null)
            {
                viewModel = new BillPayEditViewModel
                {
                    ScheduleDate = DateTime.UtcNow
                }
            }
            ;
            viewModel.Customer = await CMgr.GetCustomerAsync(CustomerID);

            viewModel.BillPayEditOp = BillPayEditOp.Create;

            return(View(viewModel));
        }
Exemplo n.º 4
0
        public IActionResult Create([Bind("Name,Address,City,State,PostCode,Phone")] Payee payee)
        {
            if (!ModelState.IsValid)
            {
                return(View(payee));
            }

            var viewModel = BillPaySessionKey.GetEditViewModelFromSession(HttpContext.Session);

            viewModel.Payee = payee;
            BillPaySessionKey.SetEditViewModelToSession(viewModel, HttpContext.Session);

            if (viewModel.BillPayEditOp == BillPayEditOp.Create)
            {
                return(RedirectToAction("Create", "BillPay"));
            }
            return(RedirectToAction("Edit", "BillPay"));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int billPayId)
        {
            var viewModel = BillPaySessionKey.GetEditViewModelFromSession(HttpContext.Session);

            if (viewModel == null)
            {
                var billPay = await BPMgr.GetBillPayAsync(billPayId);

                if (billPay == null)
                {
                    return(NotFound());
                }

                viewModel = BillPayEditViewModel.FromBillPay(billPay);

                HttpContext.Session.SetInt32(BillPaySessionKey.EditBillPayID, billPayId);
            }

            viewModel.Customer = await CMgr.GetCustomerAsync(CustomerID);

            return(View(viewModel));
        }