Example #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"));
            }
        }
Example #2
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");
			}
		}
Example #3
0
        public void TestServiceARStades()
        {
            ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();

            List<StadeWS> stades = client.getStades();
            int size = stades.Count;
            Assert.IsNotNull(stades);
            /* AJOUT */
            StadeWS zone = new StadeWS(0, "Zone TEST", 11, new List<CaracteristiqueWS>());

            client.addStade(zone);
            Assert.AreEqual(size + 1, client.getStades().Count);
            /* SUPPRESSION */
            zone = client.getStades().Find(x => x.Planete.Equals("Zone TEST"));
            client.removeStade(zone);
            Assert.AreEqual(size, client.getStades().Count);

            client.Close();
        }