public FakeFestivalRepository() { festivals = new List<Festival>(); for (int i = 0; i < 100; i++) { var festival = new Festival(); festival.Name = "Festival " + i; festival.Description = "Rad Festival " + i; festival.StartDate = DateTime.Now.AddDays(i); festival.FinishDate = DateTime.Now.AddDays(i + 3); festival.Country = "My Country" + i; festival.Website = "www." + i + ".com"; festivals.Add(festival); } }
public ActionResult Create(Festival festival) { if (ModelState.IsValid) { try { // TODO: Add insert logic here _repository.Add(festival); return RedirectToAction("CreateComplete"); } catch { return View(festival); } } else { return View(festival); } }
public void Update(Festival festival) { var ListFestival = GetFestival(festival.FestivalId); Delete(ListFestival); Add(festival); }
public void Delete(Festival festival) { var ListFestival = GetFestival(festival.FestivalId); festivals.Remove(ListFestival); }
public void Add(Festival festival) { festivals.Add(festival); }