public ActionResult Create([Bind(Include = "IdEmploye,IdEntite,date")] employehasentite employehasentite) { if (ModelState.IsValid) { int id = employehasentite.IdEmploye; var id1 = employehasentite.IdEntite; entite e1 = db.entite.Find(id1); employe e = db.employe.Find(id); // Session["des"] = e1.Designation; e.affectation = e1.Designation; db.employehasentite.Add(employehasentite); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdEmploye = new SelectList(db.employe, "idEmploye", "matricule", employehasentite.IdEmploye); ViewBag.IdEntite = new SelectList(db.entite, "idEntite", "Designation", employehasentite.IdEntite); return(View(employehasentite)); /* * employehasentite.date = Convert.ToDateTime(Request["date"]); * employehasentite.IdEmploye = 1; * employehasentite.IdEntite = 3; * db.employehasentite.Add(employehasentite); * db.SaveChanges(); * return RedirectToAction("Index"); */ }
public ActionResult Create(entite entite) { entite.Designation = Request["Designation"]; db.entite.Add(entite); db.SaveChanges(); return(RedirectToAction("Index", "entites")); }
public ActionResult DeleteConfirmed(int id) { entite entite = db.entite.Find(id); db.entite.Remove(entite); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "idEntite,Designation")] entite entite) { if (ModelState.IsValid) { db.Entry(entite).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(entite)); }
// GET: RH/entites/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } entite entite = db.entite.Find(id); if (entite == null) { return(HttpNotFound()); } return(View(entite)); }