public TreaterModel() { ICandyRepository candyRepo = new CandyDBRepository(); CandyList = new List <Candy>(candyRepo.GetList()); ICostumeRepository costumeRepo = new CostumeDBRepository(); CostumeList = new List <Costume>(costumeRepo.GetList()); ITreaterRepository treaterRepo = new TreaterDBRepository(); TreaterList = new List <Treater>(treaterRepo.GetList()); }
public IActionResult Delete(CandyModel model) { int id = -1; var repo = new CandyDBRepository(); foreach (var candy in repo.GetList()) { if (candy.ProductName == model.ProductName) { id = candy.Id; break; } } if (id != -1) { repo.Delete(id); } return(RedirectToAction("Index")); }
public CandyModel() { ICandyRepository candyRepo = new CandyDBRepository(); CandyList = new List <Candy>(candyRepo.GetList()); }