public ActionResult DeleteConfirmed(int id) { Beestje beestje = beestjesRepository.GetBeestjeById(id); beestjesRepository.DeleteBeestje(beestje); return(RedirectToAction("Index", "Beestjes")); }
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(); }
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(); }
/** * 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); }
//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)); }
// 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)); }
// 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)); }
public void DeleteBeestje(Beestje beest) { db.Beestjes.Remove(beest); db.SaveChanges(); }