public void Delete(int id) { SupplyPayment supplyPayment = Db.SupplyPayments.Find(id); Db.SupplyPayments.Remove(supplyPayment); Db.SaveChanges(); }
public void Post(SupplyPayment supplyPayment) { supplyPayment.DatePaid = DateTime.Today; supplyPayment.UserId = User.Identity.GetUserId(); Db.SupplyPayments.Add(supplyPayment); Db.SaveChanges(); }
public ActionResult Create(SupplyPayment supplyPayment) { try { supplyPayment.DatePaid = DateTime.Today; supplyPayment.UserId = User.Identity.GetUserId(); Db.SupplyPayments.Add(supplyPayment); Db.SaveChanges(); return(RedirectToAction("Details", "Supply", new { id = supplyPayment.SupplyId })); } catch { ViewBag.ErrorMessage = "Error occured while adding supply payment"; return(View("Error")); } }
public ActionResult Create(int supplyid) { SupplyPayment supplyPayment = Db.SupplyPayments.Where(pm => pm.SupplyId == supplyid).FirstOrDefault(); return(View(supplyPayment)); }