public IActionResult Index() { var liste = GerichtService.All(); var vm = new GerichtServiceIndexViewModel { Alle = liste }; return(View(vm)); }
public IActionResult Index() { var liste = GerichtService.All(); var vm = new IndexViewModel { Random = GerichtService.Random(), Alle = liste, Tags = TagService.All(), Filter = new FilterSettings() }; return(View(vm)); }
public IActionResult Edit(Guid guid) { var dbEntry = GerichtService.Single(guid); if (dbEntry == null) { return(RedirectToAction("Index")); } var vm = new CreateEditViewModel { Gericht = dbEntry, AvailableTags = TagService.All() }; return(View(vm)); }
public IActionResult Create(CreateEditViewModel vm) { var tags = TagService.All(); var newGericht = vm.Gericht; newGericht.Tags = new List <Tag>(); if (vm.SelectedTagGuids != null) { foreach (var tagGuid in vm.SelectedTagGuids) { if (tags.Single(c => c.Guid == tagGuid) != null) { newGericht.Tags.Add(tags.Single(c => c.Guid == tagGuid)); } } } GerichtService.Create(newGericht); return(RedirectToAction("Index")); }
public HomeController() { GerichtService = new GerichtService(); TagService = new TagService(); }
public IActionResult Delete(Guid guid) { GerichtService.Delete(guid); return(RedirectToAction("Index")); }