コード例 #1
0
        // GET: Campus/Delete/5
        public ActionResult Delete(int?id)
        {
            User currentUser = SessionVariables.GetCurrentUser(HttpContext);

            if (currentUser != null && currentUser.Role != null && currentUser.Role.Campuses.CanDelete)
            {
                if (id == null)
                {
                    return(NotFound());
                }
                Campus campus = DAL.GetCampus((int)id);
                return(View(campus));
            }
            else
            {
                SessionVariables.SetErrorMessage("You do not have permission to delete campuses");
                return(RedirectToAction("Index"));
            }
        }