Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 //
 // 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);
 }