public ViewResult Create(int parentId) { var model = new ExampleChildViewModel(); model.ParentId = parentId; return(View(model)); }
public ActionResult Edit(ExampleChildViewModel model) { if (ModelState.IsValid) { var child = _exampleChildrensRepository.Get(model.Id); child.Name = model.Name; _exampleChildrensRepository.Update(child); return(List(model.ParentId)); } return(View(model)); }
private bool MyFilter(object item) { ExampleChildViewModel thisItem = item as ExampleChildViewModel; if (thisItem == null) { return(false); } if (thisItem.Name == "AwkwardCoder") { return(true); } return(false); }
public ActionResult Create(ExampleChildViewModel model) { if (ModelState.IsValid) { var child = new ExampleChild() { Name = model.Name, ParentId = model.ParentId }; _exampleChildrensRepository.Create(child); return(List(model.ParentId)); } return(View(model)); }