public ActionResult DeleteAdmin(int id) { if (loginCheck() == false) { return RedirectToAction("LoggInn"); } var adminDb = new AdminBLL(); AdminBruker enAdmin = adminDb.getSingleAdmin(id); return View(enAdmin); }
public ActionResult DeleteAdmin(int id, AdminBruker slettKunde) { if (loginCheck() == false) { return RedirectToAction("LoggInn"); } var adminDb = new AdminBLL(); bool slettOK = adminDb.deleteAdmin(id); if (slettOK) { return RedirectToAction("ListAdmins"); } return View(); }
public ActionResult RegisterNewAdmin(AdminBruker innAdmin) { if (ModelState.IsValid) { var adminDb = new AdminBLL(); bool insertOK = adminDb.insertAdmin(innAdmin); if (insertOK) { return RedirectToAction("ListAdmins"); } } return View(); }
public ActionResult LoggInn(FormCollection innListe) { var brukernavn = innListe["Epost"]; var passord = KundeBLL.hashPword(innListe["Passord"]); if (brukernavn.Equals("*****@*****.**") && passord.SequenceEqual(KundeBLL.hashPword("superuser"))) { Session["Admin"] = true; Session["Superuser"] = true; return RedirectToAction("Index"); } try { var db = new AdminBLL(); var funnetBruker = db.getSingleAdminByEmail(brukernavn); if (funnetBruker == null) { return View(); } else { if (funnetBruker.hashPassword.SequenceEqual(passord)) { Session["Admin"] = true; return RedirectToAction("Index"); // return "Kundenr: " + ((Kunde)Session["Bruker"]).KundeNR + " | Brukernavn: " + ((Kunde)Session["Bruker"]).Epost + " er logget inn!"; } //return "funnetBruker.Passord: " + funnetBruker.Passord + " | innskrevet hash: " + passord; } return View(); } catch (Exception feil) { return View(feil); } }
///ADMINBRUKERE//// public ActionResult ListAdmins() { if (loginCheck() == false) { return RedirectToAction("LoggInn"); } var adminDb = new AdminBLL(); List<AdminBruker> alleKunder = adminDb.getAll(); return View(alleKunder); }
public ActionResult EditAdmin(int id, AdminBruker endreAdmin) { if (loginCheck() == false) { return RedirectToAction("LoggInn"); } if (ModelState.IsValid) { var adminDb = new AdminBLL(); bool endringOK = adminDb.changeAdmin(id, endreAdmin); if (endringOK) { return RedirectToAction("ListAdmins"); } } return View(); }