public ActionResult DeleteConfirmed(int id) { IPaymentRepository repository = new EFPaymentRepository(User.Identity.Name); // Payment payment = db.Payments.Find(id); Payment payment = repository.Get(id); // db.Payments.Remove(payment); // db.SaveChanges(); repository.Delete(payment); return RedirectToAction("Payments", "Asset", new { id = payment.AssetId }); }
// // GET: /Payment/Details/5 public ActionResult Details(int id = 0) { IPaymentRepository repository = new EFPaymentRepository(User.Identity.Name); // Payment payment = db.Payments.Find(id); Payment payment = repository.Get(id); if (payment == null) { return HttpNotFound(); } return View(payment); }
public ActionResult Create(Payment payment) { if (ModelState.IsValid) { IPaymentRepository repository = new EFPaymentRepository(User.Identity.Name); // db.Payments.Add(payment); // db.SaveChanges(); repository.Insert(payment); return RedirectToAction("Payments", "Asset", new { id = payment.AssetId }); } return View(payment); }
// private FinProjMvcContext db = new FinProjMvcContext(); // // GET: /Payment/ public ActionResult Index() { IPaymentRepository repository = new EFPaymentRepository(User.Identity.Name); // return View(db.Payments.ToList()); return View(repository.GetList()); }
public ActionResult Edit(Payment payment) { IPaymentRepository repository = new EFPaymentRepository(User.Identity.Name); if (ModelState.IsValid) { // db.Entry(payment).State = EntityState.Modified; // db.SaveChanges(); repository.Update(payment); return RedirectToAction("Payments", "Asset", new { id = payment.AssetId }); } return View(payment); }