public ActionResult Delete(int id, FormCollection collection) { try { WebApplicationJedi.ServiceReference.StadeWS stade = null; using (ServiceReference.ServiceClient service = new ServiceReference.ServiceClient()) { stade = service.getStades().First(x => x.Id == id); if (stade != null) { service.removeStade(stade); } } return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } }
// GET: Stade/Delete/5 public ActionResult Delete(int id) { try { WebApplicationJedi.ServiceReference.StadeWS stade = null; using (ServiceReference.ServiceClient service = new ServiceReference.ServiceClient()) { stade = service.getStades().First(x => x.Id == id); } if (stade == null) { return(RedirectToAction("Index")); } return(View(new StadeViewModel(stade))); } catch { return(RedirectToAction("Index")); } }