Esempio n. 1
0
        public void EditBeestje(BeestjeVM beest)
        {
            Beestje beestje = db.Beestjes.First(b => b.Id == beest.Id);

            beestje.Name            = beest.Name;
            beestje.Type            = beest.Type;
            beestje.Price           = beest.Price;
            beestje.ImagePath       = beest.ImagePath;
            db.Entry(beestje).State = EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 2
0
        public void AddBeestje(BeestjeVM beest)
        {
            Beestje beestje = new Beestje();

            beestje.Name      = beest.Name;
            beestje.Price     = beest.Price;
            beestje.ImagePath = beest.ImagePath;
            beestje.Type      = beest.Type;
            db.Beestjes.Add(beestje);
            db.SaveChanges();
        }
Esempio n. 3
0
        public List <Boeking> GetBoekingenFromBeestje(BeestjeVM beest)
        {
            List <Boeking> boekinglist     = db.Boekings.Include("Beestjes").ToList();
            List <Boeking> beestjesboeking = new List <Boeking>();

            foreach (Boeking b in boekinglist)
            {
                if (b.Beestjes.Contains(beest.Beest))
                {
                    beestjesboeking.Add(b);
                }
            }
            return(beestjesboeking);
        }
Esempio n. 4
0
 public ActionResult Create([Bind(Include = "Id,Name,Type,Price,imagePath")] BeestjeVM beestje)
 {
     if (ModelState.IsValid)
     {
         string[] validTypes = new string[] { "Woestijn", "Boerderij", "Sneeuw", "Jungle" };
         if (!validTypes.Contains(beestje.Type))
         {
             ViewBag.Error = "Kies uit de types Woestijn, Boerderij, Sneeuw of Jungle.";
             return(View());
         }
         beestjesRepository.AddBeestje(beestje);
         return(RedirectToAction("Index", "Beestjes"));
     }
     return(View(beestje));
 }
Esempio n. 5
0
        // Get an animal and show a page to edit the animal
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            Beestje beestje = beestjesRepository.GetBeestjeById(id);

            if (beestje == null)
            {
                return(HttpNotFound());
            }
            BeestjeVM beestjeVM = new BeestjeVM();

            beestjeVM.Beest = beestje;
            return(View(beestjeVM));
        }
Esempio n. 6
0
        // Shows the details of an animal
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            Beestje beestje = beestjesRepository.GetBeestjeById(id);

            if (beestje == null)
            {
                return(HttpNotFound());
            }
            BeestjeVM beestjeVM = new BeestjeVM();

            beestjeVM.Beest           = beestje;
            beestjeVM.AccessoiresList = beestjesRepository.GetAccessoiresById(beestjeVM.Id);
            beestjeVM.AllBoekingen    = beestjesRepository.GetBoekingenFromBeestje(beestjeVM);
            return(View(beestjeVM));
        }