public ActionResult Create(TypePayment typepayment) { if (ModelState.IsValid) { db.TypePayments.AddObject(typepayment); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Status = new SelectList((new TypePaymentViewModel()).GetStatus(), "Value", "Text", typepayment.Status); return View(typepayment); }
public ActionResult Edit(TypePayment typepayment) { if (ModelState.IsValid) { db.TypePayments.Attach(typepayment); db.ObjectStateManager.ChangeObjectState(typepayment, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.Status = new SelectList((new TypePaymentViewModel()).GetStatus(), "Value", "Text", typepayment.Status); return View(typepayment); }
public TypePaymentViewModel(TypePayment typePayment) { this.TypePayment = typePayment; this.Status = typePayment.Status; }