Пример #1
0
 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 });
 }
Пример #2
0
 //
 // 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);
 }
Пример #3
0
        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);
        }
Пример #4
0
 // 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());
 }
Пример #5
0
 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);
 }