public ActionResult TopUpAccount(CorporateModel model, int?paymentMethodId, string paymentMethodNote) { var company = _businessAccountService.GetAll(HotelID).FirstOrDefault(x => x.Id == model.Company.Id); var username = User.Identity.Name; var user = _personService.GetAllForLogin().FirstOrDefault(x => x.Username.Equals(username, StringComparison.CurrentCultureIgnoreCase)); if (ModelState.IsValid) { BusinessCorporateAccount bca = new BusinessCorporateAccount { Amount = model.BusinessCorporateAccount.Amount, TransactionDate = DateTime.Now, TransactionId = user.PersonID, PaymentMethodId = paymentMethodId.HasValue ? paymentMethodId.Value : 1, PaymentMethodNote = paymentMethodNote, BusinessAccountId = company.Id }; _businessAccountCorporateService.Create(bca); return(RedirectToAction("TopUpAccount", "CompanyAccount", new { id = model.Company.Id, itemSaved = true, paymentMethodId, paymentMethodNote })); } var newModel = new CorporateModel { Company = company, ItemSaved = false, PaymentMethodId = PaymentMethodEnum.Cash, PaymentMethodNote = paymentMethodNote, BusinessCorporateAccount = new BusinessCorporateAccount() }; return(View(newModel)); }
public ActionResult TopUpAccount(int?id, bool?itemSaved, int?paymentMethodId, string paymentMethodNote) { var model = new CorporateModel { Company = _businessAccountService.GetAll(HotelID).FirstOrDefault(x => x.Id == id.Value), ItemSaved = itemSaved, PaymentMethodId = PaymentMethodEnum.Cash, PaymentMethodNote = paymentMethodNote, BusinessCorporateAccount = new BusinessCorporateAccount() }; return(View(model)); }
public ActionResult TopUpAccountEdit(int?id) { var existingAmount = _businessAccountCorporateService.GetById(id.Value); var model = new CorporateModel { Company = existingAmount.BusinessAccount, ItemSaved = false, PaymentMethodId = GetPaymentMethod(existingAmount.PaymentMethodId), PaymentMethodNote = existingAmount.PaymentMethodNote, BusinessCorporateAccount = existingAmount }; return(View("TopUpAccount", model)); }