public ActionResult DeleteConfirmed(int id) { paimentModel paimentModel = db.paimentModels.Find(id); db.paimentModels.Remove(paimentModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Date,Price,Status,Title,bankcard_IdBank,cheque_IdCheque,oeuvreDec_id,userId,virement_IdVirement")] paimentModel paimentModel) { if (ModelState.IsValid) { db.Entry(paimentModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.userId = new SelectList(db.Users, "id", "accountStatuts", paimentModel.userId); return(View(paimentModel)); }
public ActionResult Create([Bind(Include = "ID,Date,Price,Status,Title,bankcard_IdBank,cheque_IdCheque,oeuvreDec_id,userId,virement_IdVirement,cheque,virement")] paimentModel paimentModel, HttpPostedFileBase Image1) { if (paimentModel.cheque != null || paimentModel.virement != null) { var request = new RestRequest("paiment", Method.POST); request.AddHeader("Content-Type", "application/json"); if (paimentModel.cheque.bank != null) { var path = Path.GetFullPath("C:\\xampp\\htdocs\\pi\\" + Image1.FileName); Image1.SaveAs(path); cheque1 = new chequeRest() { num = paimentModel.cheque.Num, agence = paimentModel.cheque.agence, bank = paimentModel.cheque.bank, price = paimentModel.cheque.Price, image = "http://localhost:8080/pi/" + Image1.FileName }; } else if (paimentModel.virement.bank != null) { virement1 = new virementRest() { agence = paimentModel.virement.agence, bank = paimentModel.virement.bank, codeVirement = paimentModel.virement.codeVirement }; } paimentRest p = new paimentRest() { //user = new UserRest() { id = 2}, title = paimentModel.Title, date = 0, price = paimentModel.Price, status = 0, cheque = cheque1, virement = virement1, user = new UserRest() { id = 1 } }; Debug.WriteLine(new JavaScriptSerializer().Serialize(p)); request.AddJsonBody(p); client.Execute(request); cheque1 = null; virement1 = null; return(RedirectToAction("Index")); } return(View(paimentModel)); }
// GET: paimentModels/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } paimentModel paimentModel = db.paimentModels.Find(id); if (paimentModel == null) { return(HttpNotFound()); } return(View(paimentModel)); }
// GET: paimentModels/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } paimentModel paimentModel = db.paimentModels.Find(id); if (paimentModel == null) { return(HttpNotFound()); } ViewBag.userId = new SelectList(db.Users, "id", "accountStatuts", paimentModel.userId); return(View(paimentModel)); }