using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace NyWeb.Controllers
{
public class ShowController : Controller
{
//
// GET: /Show/
public ActionResult Index(int s)
{
if (!string.IsNullOrEmpty(s.ToString()))
{
Ny.Model.NyModels model = new Ny.BLL.NyShare().GetShareShowModel(s);
if (model != null)
return View(model);
}
return View();
}
[ChildActionOnly]
public PartialViewResult _CommentList(string ShareId)
{
List<Ny.Model.NyModels> modelList = new Ny.BLL.NyComment().ExecCommentByShareId("CommentByShareId", new SqlParameter("@startIndex", 1),
new SqlParameter("@endIndex", 8), new SqlParameter("@shareId", ShareId));
if (modelList.Count > 0)
return PartialView(modelList);
else
return PartialView();
}
[ChildActionOnly]
public PartialViewResult _ShowListRecommend(int p)
{
List<Ny.Model.NyMenuGrandson> modelList = new Ny.BLL.NyMenuGrandson().GetListByDisplay(p);
if (modelList != null)
return PartialView(modelList);
else
return PartialView();
}
[ChildActionOnly]
public PartialViewResult _ShowListRecommendItems(int g, int shareid)
{
List<Ny.Model.NyModels> modelList = new Ny.BLL.NyShare().GetShareByMenuGrandsonRecommend(g, shareid);
if (modelList != null)
return PartialView(modelList);
else
return PartialView();
}
[ChildActionOnly]
public string _ShareListRecommendItems(int p,int shareid)
{
List<Ny.Model.NyModels> modelList = new Ny.BLL.NyShare().GetShareByMenuParentRecommend(p,shareid);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace NyWeb
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "AccountLogin",
url: "Login",
defaults: new { controller = "Home", action = "Login", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Show",
url: "{controller}/{id}",
defaults: new { controller = "Show", Index = "Index" },
constraints: new { controller = "Show", action = "Index", id = @"\d+" }
);
routes.MapRoute(
name: "AccountRegister",
url: "Register",
defaults: new { controller = "Home", action = "Register", id = UrlParameter.Optional }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace NyWeb
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "AccountLogin",
url: "Login",
defaults: new { controller = "Home", action = "Login", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Show",
url: "{controller}/{id}",
defaults: new { controller = "Show", Index = "Index" },
constraints: new { controller = "Show", action = "Index", id = @"\d+" }
);
routes.MapRoute(
name: "AccountRegister",
url: "Register",
defaults: new { controller = "Home", action = "Register", id = UrlParameter.Optional }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
}
}