title: how to pass value of viewmodel from controller to another controller
body: <p>i try to create some application using MVC 4. in my application, i can create new promo. how can i pass value from Create to Index when i using ViewModel for parameter in Index.</p>
  
  <p>this my Index</p>
  
  <pre><code>public ActionResult Index(ViewModel.Rate.RateViewModel search)
          {
              var RoomType = _RoomTypeService.GetRoomTypeName(_HotelID);
              var currency = _CurrencyService.GetAllCurrency();
  
              XNet.WebUI.Hotel.ViewModel.Rate.RateViewModel vm = new ViewModel.Rate.RateViewModel();
  
              if (search.Request == null)
              {
                  vm.RoomTypeList = ViewModel.DropDown.Builder.RoomTypeBuilder.Build(RoomType, null);
                  vm.CurrencyList = ViewModel.DropDown.Builder.CurrencyBuilder.Build(currency, null);
              }
              else
              {
                  vm.RoomTypeList = ViewModel.DropDown.Builder.RoomTypeBuilder.Build(RoomType, search.Request.RoomTypeID);
                  vm.CurrencyList = ViewModel.DropDown.Builder.CurrencyBuilder.Build(currency, search.Request.Currency);
              }
  
              vm.Request = search.Request;
  
              if (search.Request == null)
              {
                  vm.Request = new RateRequest();
                  vm.Request.CheckInFrom = null;
                  vm.Request.CheckInTo = null;
                  vm.Request.RoomTypeID = null;
              }
              if (search.Request != null)
              {
                  Session["RoomTypeID"] = search.Request.RoomTypeID;
                  Session["Breakfast"] = search.Request.Breakfast;
                  Session["Currency"] = search.Request.Currency;
              }
  
              vm.listRoomRate = GetDataIndex(vm.Request);
              _UserSession.SearchRoomRate = vm;
              return RedirectToAction("SearchResult");
          }
  </code></pre>
  
  <p>my New</p>
  
  <pre><code>[HttpPost]
          public ActionResult New(ViewModel.Rate.RateViewModel vm)
          {
              if (vm.NewRoomRate.Currency == null)
                  vm.NewRoomRate.Currency = "IDR";
  
              var NewData = _RoomRateService.NewRoomRate(vm.NewRoomRate.RoomTypeName, vm.NewRoomRate.Breakfast,
                                           Convert.ToDateTime(vm.NewRoomRate.CheckInFrom), Convert.ToDateTime(vm.NewRoomRate.CheckInTo), vm.NewRoomRate.sun, vm.NewRoomRate.mon, vm.NewRoomRate.tue,
                                           vm.NewRoomRate.wed, vm.NewRoomRate.thu, vm.NewRoomRate.fri, vm.NewRoomRate.sat, vm.NewRoomRate.Currency, vm.NewRoomRate.SingleRate,
                                           vm.NewRoomRate.DoubleRate, vm.NewRoomRate.TripleRate, Convert.ToDecimal(vm.NewRoomRate.Commision), Convert.ToInt32(vm.NewRoomRate.Allotment), vm.NewRoomRate.CloseSelling,
                                           vm.NewRoomRate.FreeSell);
  
              if (NewData == null)
              {
                  ModelState.AddModelError("failed", "RoomRate is already created, please use edit instead");
                  return New();
              }
  
              ViewModel.Rate.RateViewModel test = new ViewModel.Rate.RateViewModel();
              test.Request = new RateRequest();
              test.Request.RoomTypeID = Convert.ToInt32(vm.NewRoomRate.RoomTypeName);
              return RedirectToAction("Index", new {search = test.Request });
          }
  </code></pre>
  
  <p>i try like this, but i get error like this</p>
  
  <pre><code>Server Error in '/' Application.
  The model item passed into the dictionary is of type '&lt;&gt;f__AnonymousType0`1[XNet.WebUI.Hotel.ViewModel.RateRequest]', but this dictionary requires a model item of type 'XNet.WebUI.Hotel.ViewModel.Rate.RateViewModel'. 
  </code></pre>
  
  <p>can some one tell me, how i can do this?
  thanks</p>