// GET: Bestilling
        public ActionResult BestillingListe()
        {
            var bestillingDb = new BestillingBLL();
            List <Bestilling> alleBestillinger = bestillingDb.hentAlleBestillinger();

            return(View(alleBestillinger));
        }
Example #2
0
        public ActionResult VisViewModel()
        {
            if (!CheckSession())
            {
                return(RedirectToAction("IngenTilgang", "Admin"));
            }
            DbModel VM = new DbModel();

            try
            {
                var dbRuter        = new RuteBLL();
                var dbFlymaskiner  = new FlymaskinBLL();
                var dbFlyplasser   = new FlyplassBLL();
                var dbKunder       = new KundeBLL();
                var dbPoststeder   = new PoststedBLL();
                var dbBestillinger = new BestillingBLL();
                var dbBrukere      = new BrukerBLL();

                VM.Ruter        = dbRuter.alleRuter();
                VM.Flymaskiner  = dbFlymaskiner.alleFlymaskiner();
                VM.Flyplasser   = dbFlyplasser.alleFlyplasser();
                VM.Kunder       = dbKunder.alleKunder();
                VM.Poststeder   = dbPoststeder.allePoststeder();
                VM.Bestillinger = dbBestillinger.alleBestillinger();
                VM.Brukere      = dbBrukere.alleBrukere();
                return(View(VM));
            }
            catch (Exception ex)
            {
                LogError(ex);
                return(View("~/Views/Error/Error.cshtml"));
            }
        }
        public ActionResult slettBestilling(int id)
        {
            var        bestillingDb = new BestillingBLL();
            Bestilling enBestilling = bestillingDb.hentEnBestilling(id);

            return(View(enBestilling));
        }
        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 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 ActionResult RegistrerBestilling(Bestilling innBestilling)
 {
     if (ModelState.IsValid)
     {
         var  bestilling = new BestillingBLL();
         bool insertOk   = bestilling.leggTilBestilling(innBestilling);
         if (insertOk)
         {
             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"));
 }
Example #8
0
        public ActionResult visKvitering(int ordreID = 0)
        {
            /*var db = new Models.BestillingContext();
             * Models.Bestilling bestilling = db.Bestillinger.Find(ordreID);
             * if(bestilling==null)
             * {
             *  return HttpNotFound();
             * }
             * return View(bestilling);  */

            var        BLL        = new BestillingBLL();
            Bestilling bestilling = BLL.visKvitering(ordreID);

            if (bestilling == null)
            {
                return(HttpNotFound());
            }
            return(View(bestilling));
        }
        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 BestillingController(BestillingBLL bestillingBLL)
 {
     this.bestillingBLL = bestillingBLL;
 }