public IndexViewModel(RegularPayment regularPayment) { RegularPaymentId = regularPayment.RegularPaymentId; Amount = regularPayment.Amount; Name = regularPayment.Name; PaymentDay = regularPayment.PaymentDay; }
public EditRegularPaymentViewModel(RegularPayment regularPayment) { RegularPaymentId = regularPayment.RegularPaymentId; Name = regularPayment.Name; Amount = regularPayment.Amount; PaymentDay = regularPayment.PaymentDay; BankAccountId = regularPayment.BankAccountId; }
public void UpdateRegularPayment(RegularPayment newRegularPayment) { RegularPayment regularPayment = context.RegularPayments.Where(f => f.RegularPaymentId == newRegularPayment.RegularPaymentId).FirstOrDefault(); regularPayment.Name = newRegularPayment.Name; regularPayment.Amount = newRegularPayment.Amount; regularPayment.PaymentDay = newRegularPayment.PaymentDay; context.SaveChanges(); }
public EditViewModel(RegularPayment regularPayment) { var accounts = bankAccountRepository.GetBankAccounts(); Id = regularPayment.RegularPaymentId; Name = regularPayment.Name; Amount = regularPayment.Amount; PaymentDay = regularPayment.PaymentDay; Accounts = accounts.Select(a => new SelectListItem { Value = a.BankAccountId.ToString(), Text = a.Name }); }
public void InsertRegularPayment(RegularPayment regularPayment) { context.RegularPayments.Add(regularPayment); context.SaveChanges(); }
public ActionResult EditRegularPayment(EditRegularPaymentViewModel model) { if (ModelState.IsValid) { RegularPayment regularPayment = new RegularPayment { RegularPaymentId = model.RegularPaymentId, Name = model.Name, Amount = model.Amount, PaymentDay = model.PaymentDay, BankAccountId = model.BankAccountId }; regularPaymentsRepository.UpdateRegularPayment(regularPayment); return RedirectToAction("Details", new { accountId = model.BankAccountId }); } else { return View(model); } }