public ActionResult Create(MethodOfPayment methodofpayment) { if (ModelState.IsValid) { db.MethodsOfPayment.Add(methodofpayment); db.SaveChanges(); return RedirectToAction("Index"); } return View(methodofpayment); }
public void Update(int id, MethodOfPayment item) { var method = Context.MethodsOfPayment.FirstOrDefault(x => x.Id.Equals(id)); if (method == null) { throw new InvalidOperationException(); } method.Name = item.Name; method.Description = item.Description; Context.SaveChanges(); }
public ActionResult Edit(MethodOfPayment methodofpayment) { if (ModelState.IsValid) { db.Entry(methodofpayment).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(methodofpayment); }
public void Create(MethodOfPayment item) { item = Context.MethodsOfPayment.Add(item); Context.SaveChanges(); }