一个Action:
Code
/// <summary>
/// Friend好友的地
/// </summary>
/// <returns></returns>
public ActionResult FriendFarm(string pid)
{
BLL.DTOFarm farm = new AppleGrange.BLL.DTOFarm(pid);
farm.CurrentUser = BLL.UserInfoService.GetSingleUser(LoginUser.PingCoID);
return View(farm);
}
/// <summary>
/// Friend好友的地
/// </summary>
/// <returns></returns>
public ActionResult FriendFarm(string pid)
{
BLL.DTOFarm farm = new AppleGrange.BLL.DTOFarm(pid);
farm.CurrentUser = BLL.UserInfoService.GetSingleUser(LoginUser.PingCoID);
return View(farm);
}
另一个:
Code
/// <summary>
/// 给好友浇水【为Ta浇水】
/// </summary>
/// <param name="farmid"></param>
/// <param name="pid"></param>
/// <returns></returns>
public ActionResult WateringToFriend(string farmid)
{
Tempdata["msg"] = BLL.UserFarmService.WateringToFriend(farm,LoginUser.PingCoID);
return RedirectToAction("FriendFarm", new { pid = farm.PingcoID, sid = Request["sid"]});
}
/// <summary>
/// 给好友浇水【为Ta浇水】
/// </summary>
/// <param name="farmid"></param>
/// <param name="pid"></param>
/// <returns></returns>
public ActionResult WateringToFriend(string farmid)
{
Tempdata["msg"] = BLL.UserFarmService.WateringToFriend(farm,LoginUser.PingCoID);
return RedirectToAction("FriendFarm", new { pid = farm.PingcoID, sid = Request["sid"]});
}
以上这个没有问题,只是在“摩洛哥”下支持302跳转(有时候不支持,sid要自己带。), 但是不支持session。
所以Tempdata过不去。(没有提示信息)
如果用以下方式:
Code
/// <summary>
/// 给好友浇水【为Ta浇水】
/// </summary>
/// <param name="farmid"></param>
/// <param name="pid"></param>
/// <returns></returns>
public ActionResult WateringToFriend(string farmid)
{
ViewData["msg"] = BLL.UserFarmService.WateringToFriend(farm,LoginUser.PingCoID);
BLL.DTOFarm Farm = new AppleGrange.BLL.DTOFarm(farm.PingcoID);
Farm.CurrentUser = BLL.UserInfoService.GetSingleUser(LoginUser.PingCoID);
return View("FriendFarm", Farm);
}
/// <summary>
/// 给好友浇水【为Ta浇水】
/// </summary>
/// <param name="farmid"></param>
/// <param name="pid"></param>
/// <returns></returns>
public ActionResult WateringToFriend(string farmid)
{
ViewData["msg"] = BLL.UserFarmService.WateringToFriend(farm,LoginUser.PingCoID);
BLL.DTOFarm Farm = new AppleGrange.BLL.DTOFarm(farm.PingcoID);
Farm.CurrentUser = BLL.UserInfoService.GetSingleUser(LoginUser.PingCoID);
return View("FriendFarm", Farm);
}
注意
要把FriendFarm 的Action的Farm模型带过去。