mvc 分部视图

public class UserPartialController : Controller
    {
        // GET: UserPartial
        public ActionResult LoginPartial()
        {
            if (Session["OwnUser"] == null)
            {
                string name = "";
                string password = "";
                ResponseParam _ResponseParam = new ResponseParam();
                try
                {
                    _ResponseParam = PostHelper.SendByHttpClienttoApi_LoginOn(name, password);
                }
                catch (Exception)
                {
                }

                if (_ResponseParam != null)
                {
                    if (_ResponseParam.Success)
                    {
                        Abs_Member _Abs_Member = new Abs_Member();
                        _Abs_Member.Name = _ResponseParam.MemberInfo.MemberName;
                        _Abs_Member.Password = password;
                        Dictionary<string, string> roleDic = new Dictionary<string, string>();
                        roleDic.Add("hgtl", "0");
                        roleDic.Add("tradedb", "0");
                        foreach (MemberRoleDTO item in _ResponseParam.MemberInfo.MemberRoles)
                        {
                            if (item.DB == "hgtl")
                            {
                                roleDic["hgtl"] = "1";
                            }
                            if (item.DB == "tradedb")
                            {
                                roleDic["tradedb"] = "1";
                            }
                        }
                        _Abs_Member.DBdic = roleDic;

                        Session["OwnUser"] = _Abs_Member;

                        try
                        {
                            OperateParam _OperateParam = new OperateParam();

                            _OperateParam.MemberName = Session["OwnUser"] == null ? "游客" : (Session["OwnUser"] as Abs_Member).Name;
                            _OperateParam.VisitdData = "";
                            _OperateParam.VisitdDataID = "";
                            string url = Request.Url.ToString();
                            _OperateParam.URL = url.IndexOf('?') > 0 ? url.Substring(0, url.IndexOf('?')) : url;
                            _OperateParam.VisitDate = DateTime.Now.ToString();
                            _OperateParam.OperateType = "登录";
                            PostHelper.SendByHttpClienttoApi_SaveLog(_OperateParam);
                        }
                        catch (Exception)
                        {

                        }
                    }
                }
            }
            return PartialView();
        }



    }
 @Html.Action("LoginPartial", new { controller = "UserPartial" })

  没有 action

@Html.Partial("_MenuPartial")

  

posted @ 2018-03-12 11:09  caolingyi  阅读(180)  评论(0编辑  收藏  举报