Exemplo n.º 1
0
        public ActionResult EditRechargeAccount(int id)
        {
            var rechargeAccount = _repositoryFactory.RechargeAccountRepository.GetNullableById(id);

            if (rechargeAccount == null)
            {
                Message = "Recharge account could not be found.";
                return(RedirectToAction("RechargeAccounts"));
            }

            return(View(RechargeAccountViewModel.Create(rechargeAccount)));
        }
Exemplo n.º 2
0
        public ActionResult CreateRechargeAccount(RechargeAccount rechargeAccount)
        {
            rechargeAccount.User = GetCurrentUser(true);
            ModelState.Clear();
            rechargeAccount.TransferValidationMessagesTo(ModelState);

            if (ModelState.IsValid)
            {
                _repositoryFactory.RechargeAccountRepository.EnsurePersistent(rechargeAccount);
                Message = "Recharge Account has been saved.";
                return(RedirectToAction("RechargeAccounts"));
            }

            return(View(RechargeAccountViewModel.Create(rechargeAccount)));
        }
Exemplo n.º 3
0
        public ActionResult EditRechargeAccount(int id, RechargeAccount rechargeAccount)
        {
            var rechargeAccountToEdit = _repositoryFactory.RechargeAccountRepository.GetNullableById(id);

            if (rechargeAccountToEdit == null)
            {
                Message = "Recharge account could not be found.";
                return(RedirectToAction("RechargeAccounts"));
            }

            AutoMapper.Mapper.Map(rechargeAccount, rechargeAccountToEdit);
            ModelState.Clear();
            rechargeAccountToEdit.TransferValidationMessagesTo(ModelState);

            if (ModelState.IsValid)
            {
                _repositoryFactory.RechargeAccountRepository.EnsurePersistent(rechargeAccountToEdit);
                Message = "Recharge Account has been saved.";
                return(RedirectToAction("RechargeAccounts"));
            }

            return(View(RechargeAccountViewModel.Create(rechargeAccountToEdit)));
        }
Exemplo n.º 4
0
 public ActionResult CreateRechargeAccount()
 {
     return(View(RechargeAccountViewModel.Create()));
 }