Exemple #1
0
        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"));
            }
        }
Exemple #2
0
        // 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"));
            }
        }