Exemplo n.º 1
0
        public ActionResult Delete(Int64 UserID)
        {
            Models.User oUser = new Models.User();
            if (ModelState.IsValid)
            {
                int nStatus = 0;
                if (UserID != 0)
                {
                    nStatus = oUser.DeleteUser(UserID, "DELETE");
                }
                switch (nStatus)
                {
                case -1: ViewBag.Message = "User information already exists";
                    break;

                case 1: ViewBag.Message = "Error";
                    break;

                case 3: ViewBag.Message = "User information deleted successfully";
                    break;
                }
            }
            ViewBag.Action         = "ManageUser";
            ViewBag.ControllerName = "Account";
            return(View());
        }
Exemplo n.º 2
0
        //Delete the user based on the URI, after veryfiying the user is authorised to do so
        public ActionResult DeleteUser()
        {
            int uId = Request.QueryString["id"].AsInt(0);

            //Fetch the user model
            Models.User u = new Models.User();

            //Is the user authenticated?
            if (Session["userID"] != null)
            {
                //Is the user an administrator?
                if ((int)Session["admin"] == 1)
                {
                    //Delete the user
                    u.DeleteUser(uId);
                }
            }

            return(RedirectToAction("Index", "User"));
        }
Exemplo n.º 3
0
 public ActionResult DeleteUser(string email)
 {
     Models.User user = new Models.User();
     user.DeleteUser(email);
     return(View());
 }
Exemplo n.º 4
0
        public ActionResult Delete(Int64 nID, string sType, string sActionName, string sControllerName)
        {
            string Message = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    int nStatus = 0;
                    if (nID != 0)
                    {
                        switch (sType)
                        {
                        case "User":
                        {
                            Models.User oUser = new Models.User();
                            nStatus = oUser.DeleteUser(nID, "DELETE");
                            if (oUser != null)
                            {
                                oUser.Dispose();
                                oUser = null;
                            }
                            break;
                        }

                        case "Aircraft":
                        {
                            Models.Aircraft oAircraft = new Models.Aircraft();
                            nStatus = oAircraft.DeleteAircraft(nID, "DELETE");
                            if (oAircraft != null)
                            {
                                oAircraft.Dispose();
                                oAircraft = null;
                            }
                            break;
                        }

                        case "Airline":
                        {
                            Models.Airline oAirline = new Models.Airline();
                            nStatus = oAirline.DeleteAirline(nID, "DELETE");
                            if (oAirline != null)
                            {
                                oAirline.Dispose();
                                oAirline = null;
                            }
                            break;
                        }

                        case "BME": { break; }

                        case "Stand": { break; }

                        case "Assocciation": { break; }
                        }
                    }
                    switch (nStatus)
                    {
                    case -1: ViewBag.Message = sType + " information already exists";
                        break;

                    case 1: ViewBag.Message = "Error";
                        break;

                    case 3: ViewBag.Message = sType + " information deleted successfully";
                        break;
                    }
                }
                ViewBag.Action         = sActionName;
                ViewBag.ControllerName = sControllerName;
            }
            catch (Exception ex)
            {
            }
            return(View());
        }