예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Beestje beestje = beestjesRepository.GetBeestjeById(id);

            beestjesRepository.DeleteBeestje(beestje);
            return(RedirectToAction("Index", "Beestjes"));
        }
예제 #2
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();
        }
예제 #3
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();
        }
예제 #4
0
 /**
  * Check if the animal has a booking on the same date as the current booking.
  */
 public bool BeestjeHasNoBoeking(Beestje b, BoekingVM currentBoeking, IBoekingRepository boekingsRepository)
 {
     foreach (Boeking boeking in boekingsRepository.GetAllBoeking())
     {
         if (boeking.Beestjes != null && boeking.Beestjes.FirstOrDefault(beest => beest.Id == b.Id) != null && boeking.Date == currentBoeking.Date)
         {
             return(false);
         }
     }
     return(true);
 }
예제 #5
0
        //Get the selected animal and show the delete page
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            Beestje beestje = beestjesRepository.GetBeestjeById(id);

            if (beestje == null)
            {
                return(HttpNotFound());
            }
            return(View(beestje));
        }
예제 #6
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));
        }
예제 #7
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));
        }
예제 #8
0
 public void DeleteBeestje(Beestje beest)
 {
     db.Beestjes.Remove(beest);
     db.SaveChanges();
 }