コード例 #1
0
        public ActionResult Slett(int id)
        {
            var   kundeDb = new DBKunde();
            Kunde enKunde = kundeDb.hentEnKunde(id);

            return(View(enKunde));
        }
コード例 #2
0
        public ActionResult Liste()
        {
            var          kundeDb    = new DBKunde();
            List <Kunde> alleKunder = kundeDb.hentAlle();

            return(View(alleKunder));
        }
コード例 #3
0
        public ActionResult Slett(int id, Kunde slettKunde)
        {
            var  kundeDb = new DBKunde();
            bool slettOK = kundeDb.slettKunde(id);

            if (slettOK)
            {
                return(RedirectToAction("Liste"));
            }
            return(View());
        }
コード例 #4
0
 public ActionResult Endre(int id, Kunde endreKunde)
 {
     if (ModelState.IsValid)
     {
         var  kundeDb   = new DBKunde();
         bool endringOK = kundeDb.endreKunde(id, endreKunde);
         if (endringOK)
         {
             return(RedirectToAction("Liste"));
         }
     }
     return(View());
 }
コード例 #5
0
 public ActionResult Registrer(Kunde innKunde)
 {
     if (ModelState.IsValid)
     {
         var  kundeDb  = new DBKunde();
         bool insertOK = kundeDb.settInn(innKunde);
         if (insertOK)
         {
             return(RedirectToAction("Liste"));
         }
     }
     return(View());
 }