public ActionResult NewsList(string button, int?id) { if (Session["userId"] != null) { if (id.HasValue) { if (button == "Изменить") { return(Redirect("/Redaction/NewsAdd/?id=" + id.Value)); } else { try { NewsService service = new NewsService(Server.MapPath("~/Content/Upload/Entities/")); service.DelElement(id.Value); return(Redirect("/Redaction/NewsList")); } catch (Exception ex) { string message = ""; while (ex != null) { message = ex.Message; ex = ex.InnerException; } message = message.Replace('\n', ' '); return(Redirect("/Message/MessageShow/?message=" + message + "&href=" + Request.Url)); } } } else { return(Redirect("/Redaction/NewsAdd")); } } else { return(Redirect("/Home/Authorization")); } }