public IHttpActionResult DelAbonnement(int id) { Abonnement abonnement = abonnementService.GetById(id); if (abonnement == null) { return(NotFound()); } if (!ModelState.IsValid) { return(BadRequest("Not a valid model")); } abonnementService.Delete(abonnement); abonnementService.Commit(); return(Ok()); }
public ActionResult Delete(int id, FormCollection collection) { Abonnement abonnement = abonnementService.GetById(id); if (abonnement == null) { return(RedirectToAction("Index")); } else { try { // TODO: Add delete logic here abonnementService.Delete(abonnement); abonnementService.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } } }