public PartialViewResult MainMenu(int ctrId, string url, int cateId = 0, string slug = "Index") { var model = new ModelMenusItem { CtrId = ctrId }; if (Request["doAction"] == "setting") { model.ListMenuGroupsItem = _bl.GetMenusGroup(); var key = _sysbl.GetKey(ctrId); model.PageId = key != null?int.Parse(key.Value) : 0; return(PartialView(model)); } else { var urlpath = Request.Path.Split('/'); model.CtrUrl = url; var key = _sysbl.GetKey(ctrId); var val = key != null?int.Parse(key.Value) : 1; model.ListItem = _bl.GetListMenus(val); model.Slug = slug; model.Url = urlpath.Length > 1 ? urlpath[1] : urlpath[0]; var codeCookie = HttpContext.Request.Cookies["addtocart"]; if (codeCookie == null) { model.CountCart = 0; } else { var temp = codeCookie.Value; var lst = new JavaScriptSerializer().Deserialize <List <ShopProductDetailCartItem> >(temp); model.CountCart = lst.Count; } return(PartialView(model)); } }