public ActionResult Edit(CategoryViewModel categoryVM) { if (ModelState.IsValid) { var selectedString = categoryVM.SelectedStrings; _categoryRepo.Save(categoryVM.Category); TempData["message"] = string.Format("{0} was saved.", categoryVM.Category.Name); return RedirectToAction("Index"); } return View(categoryVM); }
// // GET: /Category/Edit/ public ViewResult Edit(Guid id) { var categoryViewModel = new CategoryViewModel { Category = _categoryRepo.FindByID(id), SelectedStrings = new List<SelectedStringsViewModel> { new SelectedStringsViewModel { Selected = false, Text = "FirstString" }, new SelectedStringsViewModel { Selected = false, Text = "SecondString" } } }; return View(categoryViewModel); }