public ActionResult Create() { ViolationViewModel vm = new ViolationViewModel(); vm.PopulateDropDowns(this.eventTasks.GetViolations()); return(View(vm)); }
public ActionResult Edit(int id) { Violation v = this.eventTasks.GetViolation(id); if (v != null) { ViolationViewModel vm = new ViolationViewModel(); vm.Id = v.Id; vm.Name = v.Name; vm.Keywords = v.Keywords; vm.Description = v.Description; vm.ConditionalityInterest = v.ConditionalityInterest; if (v.ParentViolation != null) { vm.ParentViolationID = v.ParentViolation.Id; } IList <Violation> parentCandidates = this.eventTasks.GetViolations(); parentCandidates.Remove(v); vm.PopulateDropDowns(parentCandidates); return(View(vm)); } else { return(new HttpNotFoundResult()); } }