public ActionResult Odstranit(int id)
        {
            UzivatelDao uzivatelDao = new UzivatelDao();
            Uzivatel    uzivatel    = uzivatelDao.GetById(id);

            uzivatelDao.Delete(uzivatel);
            TempData["message-success"] = "Uživatel byl úspěšně odstraněn";
            return(RedirectToAction("Index", "Uzivatel"));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            var dao  = new UzivatelDao();
            var item = dao.GetById(id);

            if (item == null)
            {
                return(RedirectToAction("Index"));
            }
            var permDao  = new PermissionDao();
            var permItem = permDao.GetByUser(item);

            if (permItem != null)
            {
                permDao.Delete(permItem);
            }

            dao.Delete(item);
            TempData[MessagesHelper.Success] = Resources.UzivatelTexts.UserDeleted;
            return(RedirectToAction("Index"));
        }