Esempio n. 1
0
        public ActionResult AdminStart(FormCollection form)
        {
            //Innan vi listar ut däcken måste vi försöka spara vem som är inloggad på ett bra sätt!! Cookie?
            HttpCookie Newcookie = Request.Cookies["User"];

            Newcookie.Expires = DateTime.Now.AddHours(5);

            user theuser = new user();

            theuser          = dbc.GetUser(Convert.ToInt32(Newcookie.Value));
            TempData["user"] = theuser.userID;
            var searcha = form["searchadmin"];
            var season  = form["season"];

            var newsbutton  = form["newsbutton"];
            var newstext    = form["newstext"];
            var newstitle   = form["newstitle"];
            var deletetire2 = form["deletetire2"];
            var deletetire  = form["deletetire"];
            var deleteuser  = form["deleteuser"];

            if (deletetire2 != null && deleteuser == null)
            {
                //ta bort däck
                dbc.DeleteTire(Convert.ToInt32(deletetire2));
            }
            if (deleteuser != null && deletetire == null)
            {
                //ta bort user
                dbc.DeleteUser(Convert.ToInt32(deleteuser));
            }
            if (newsbutton != null)
            {
                //ändra nyheterna
                news nyheter = dbc.GetTheNews(Convert.ToInt32(newsbutton));
                nyheter.title = newstitle;
                nyheter.text  = newstext;
                dbc.UpdateNews(nyheter);
            }
            return(RedirectToAction("AdminStart", "Home", new { id = theuser.userID, search = searcha, season = season }));
        }
Esempio n. 2
0
 public bool DelUser(Guid iduser)
 {
     return(DbOp.DeleteUser(iduser));
 }