Exemplo n.º 1
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            //try
            //{
            //    Domain.Entity.Ressource R = db.Ressources.Find(id);
            //    db.Ressources.Remove(R);
            //    db.SaveChanges();
            //}
            //catch (DataException/* dex */)
            //{
            //    //Log the error (uncomment dex variable name and add a line here to write a log.
            //    return RedirectToAction("Delete", new { id = id, saveChangesError = true });
            //}
            //return RedirectToAction("Index");
            try
            {
                serviceRessource.Delete(serviceRessource.GetById(id));
                serviceRessource.Commit();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(id));
            }
        }
Exemplo n.º 2
0
        public ActionResult Delete2(int id, ResourceModel pm)
        {
            try
            {
                // TODO: Add delete logic here
                Ressource p = rs.GetById(id);
                rs.Delete(p);
                rs.Commit();

                return(RedirectToAction("Index2"));
            }
            catch
            {
                return(View());
            }
        }