Пример #1
0
        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());
        }
Пример #2
0
        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());
                }
            }
        }