/// <summary> /// Suppression d'un fournisseur /// </summary> /// <param name="id">id du fournisseur sélectionné</param> /// <returns>vue suppression</returns> public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { //nombre d'occurences provider/contract int counter = db.tbl_607_order.Include(t => t.FK_ID_provider).Where(t => t.FK_ID_provider == id).Count(); if (counter == 0) { tbl_607_provider tbl_607_provider = db.tbl_607_provider.Find(id); if (tbl_607_provider == null) { return(HttpNotFound()); } return(View(tbl_607_provider)); } else { //on averti l'utilisateur qu'il y a deja un poste ayant ce numéro ViewBag.message = "Forbidden"; //generation de la vue partielle return(View("_PartialMessage")); } } }
/// <summary> /// Affichage de la page Détails du fournisseur séléctionné /// </summary> /// <param name="id">id du fournisseur selectionné</param> /// <returns>retourne les données correspondantes</returns> public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_607_provider tbl_607_provider = db.tbl_607_provider.Find(id); if (tbl_607_provider == null) { return(HttpNotFound()); } return(View(tbl_607_provider)); }
public ActionResult DeleteConfirmed(int id) { tbl_607_provider tbl_607_provider = db.tbl_607_provider.Find(id); db.tbl_607_provider.Remove(tbl_607_provider); try { db.SaveChanges(); return(RedirectToAction("Index")); } catch (DbEntityValidationException ex) { string s = ex.Message; return(RedirectToAction("../Ooops", new { message = s })); } }
public ActionResult Edit([Bind(Include = "ID,provider_name,adress,cp,town,phone,fax,mail,adress_compl")] tbl_607_provider tbl_607_provider) { if (ModelState.IsValid) { db.Entry(tbl_607_provider).State = EntityState.Modified; try { db.SaveChanges(); return(RedirectToAction("Index")); } catch (DbEntityValidationException ex) { string s = ex.Message; return(RedirectToAction("../Ooops", new { message = s })); } } return(View(tbl_607_provider)); }