示例#1
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                WebApplicationJedi.ServiceReference.TournoiWS tournoi = null;
                using (ServiceReference.ServiceClient service = new ServiceClient())
                {
                    tournoi = service.getTournois().First(x => x.Id == id);

                    if (tournoi != null)
                    {
                        foreach (var m in tournoi.Matches)
                        {
                            service.removeMatch(m);
                        }
                        service.removeTournoi(tournoi);
                    }
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
示例#2
0
        // GET: Tournoi/Delete/5
        public ActionResult Delete(int id)
        {
            WebApplicationJedi.ServiceReference.TournoiWS tournoi = null;

            using (ServiceReference.ServiceClient service = new ServiceClient())
            {
                tournoi = service.getTournois().First(x => x.Id == id);
            }

            if (tournoi != null)
            {
                return(View(new TournoiViewModel(tournoi)));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }