Exemplo n.º 1
0
        public ActionResult Delete(Setting set)
        {
            try
            {
                session.IsAuthenticated();

                bool sliderSetting = settingManager.DeleteSliderSettings(session.ActiveUserId);
                bool basicSetting  = settingManager.DeleteSettings(session.ActiveUserId);
                bool user          = userManager.DeleteUser(session.ActiveUserId);
                bool deleteFiles   = DeleteImageFiles();

                if (user == true && basicSetting == true && sliderSetting == true && deleteFiles == true)
                {
                    ViewBag.SaveMessage = "Permanently delete user and all settings successfully.";
                    session.ClearAll();
                    Response.Redirect("~/");
                }
                else
                {
                    ViewBag.ExErrorMessage = "Failed to delete.";
                }
            }
            catch (Exception ex)
            {
                ViewBag.ExErrorMessage = ex.Message;
                return(View());
            }

            return(View());
        }