public ActionResult Edit2(int customerId) { var model = new HomeServices().Process(new HomeModel()); ((HomeModel)model).Customer = ((HomeModel)model).Customers[0]; ((HomeModel)model).Customer.CompanyName = "入力値エラー"; return PartialView("_customerEditor2", ((HomeModel)model).Customer); }
/// <summary> /// For example Use customModelBinder only this Actions. /// </summary> /// <param name="inputModel"></param> /// <returns></returns> public ActionResult Index([ModelBinder(typeof(CustomModelBinder))] HomeModel inputModel) { var model = new HomeServices().Process(inputModel); return View(model); }
public ActionResult Edit([Bind(Prefix = "customerList")] int customerId) { var model = new HomeServices().Process(new HomeModel()); ((HomeModel)model).Customer = ((HomeModel)model).Customers[customerId - 1]; return PartialView("_customerEditor", ((HomeModel)model).Customers[customerId - 1]); }