public ActionResult endreBestilling(int id)
 {
     var bestillingDb = new BestillingBLL();
     Bestilling enBestilling = bestillingDb.hentEnBestilling(id);
     if (Session["Innlogget"] == null)
     {
         Session["Innlogget"] = false;
         ViewBag.Innlogget = false;
     }
     else
     {
         ViewBag.Innlogget = (bool)Session["Innlogget"];
         bool ok = (bool)Session["Innlogget"];
         if (ok) return View(enBestilling);
     }
     return RedirectToAction("Home");
 }
 // GET: Bestilling
 public ActionResult BestillingListe()
 {
     var bestillingDb = new BestillingBLL();
     List<Bestilling> alleBestillinger = bestillingDb.hentAlleBestillinger();
     if (Session["Innlogget"] == null)
     {
         Session["Innlogget"] = false;
         ViewBag.Innlogget = false;
     }
     else
     {
         ViewBag.Innlogget = (bool)Session["Innlogget"];
         bool ok = (bool)Session["Innlogget"];
         if (ok) return View(alleBestillinger);
     }
     return RedirectToAction("Home");
 }
 public ActionResult endreBestilling(int id, Bestilling endreBestilling)
 {
     if(ModelState.IsValid)
     {
         var bestilling = new BestillingBLL();
         bool endringOk = bestilling.endreBestilling(id, endreBestilling);
         if(endringOk)
         {
             return RedirectToAction("BestillingListe");
         }
     }
     return View();
 }
 public BestillingController(BestillingBLL bestillingBLL)
 {
     this.bestillingBLL = bestillingBLL;
 }
 public ActionResult slettBestilling(int id, Bestilling slettBestilling)
 {
     var bestillingDb = new BestillingBLL();
     bool slettOk = bestillingDb.slettBestilling(id);
     if(slettOk)
     {
         return RedirectToAction("BestillingListe");
     }
     return View();
 }
        public ActionResult RegistrerBestilling(int id)
        {
            if(ModelState.IsValid)
            {
                BestillingBLL bestilling = new BestillingBLL();
                bool ok = bestilling.leggTilBestilling(id);
                if (ok) RedirectToAction("BestillingListe");

            }
            return RedirectToAction("BestillingListe");
        }