public ActionResult News_Edit(int id) { var entity = AutoEntityMap <News, NewsView> .EntityMap(base.NewsBLL.Where(c => c.Id == id).FirstOrDefault()); GetIist(); return(View(entity)); }
/// <summary> /// 新闻列表 /// </summary> /// <returns></returns> public ActionResult News() { List <Category> categoryList = base.CategoryBLL.Where().ToList(); ViewBag.list = categoryList.Select(c => new { id = c.CategoryId, name = c.CategroyTitle }); List <NewsView> newsList = AutoEntityMap <News, NewsView> .EntityMap(base.NewsBLL.Where().ToList()); return(View(newsList)); }
// GET: Admin/Dashboard public ActionResult Index() { List <Category> categoryList = base.CategoryBLL.Where().ToList(); ViewData["category"] = AutoEntityMap <Category, CategoryView> .EntityMap(categoryList); TempData["total"] = base.CategoryBLL.Where().Count(); ViewData["total"] = base.CategoryBLL.Where().Count(); return(View()); }
public ActionResult Category(int?isdelcallback) { if (isdelcallback == 1) { JavaScript("< Script > alert('删除成功!');</Script>"); } int currentpager = Request.QueryString["currentpager"] == null?1: int.Parse(Request.QueryString["currentpager"]); int count = Request.QueryString["pagerSize"] == null?2: int.Parse(Request.QueryString["pagerSize"]); //ViewBag.total = base.CategoryBLL.Where().Count(); TempData["total"] = base.CategoryBLL.Where().Count(); int skipsize = (currentpager - 1) * count; List <CategoryView> categoryList = AutoEntityMap <Category, CategoryView> .EntityMap(base.CategoryBLL.Where().Skip(skipsize).Take(count).ToList()); return(PartialView(categoryList)); }
public ActionResult Login(UserInfoView entityView) { if (ModelState.IsValid) { UserInfo entity = AutoEntityMap <UserInfoView, UserInfo> .EntityMap(entityView); string pwd = Kits.GetMD5(entity.UserPwd); bool b = UserInfoBLL.Where(c => c.UserName == entity.UserName && c.UserPwd == pwd).Any(); if (b) { Session[Keys.SessionKey] = entity.UserName; return(RedirectToAction("Index", "Dashboard")); } } ModelState.AddModelError("", "用户名或密码错误"); return(View()); }
public ActionResult Category_Create(CategoryView entity) { try { if (ModelState.IsValid) { base.CategoryBLL.Add(AutoEntityMap <CategoryView, Category> .EntityMap(entity)); base.CategoryBLL.SaveChanges(); return(RedirectToAction("Category")); } return(PartialView()); } catch (System.Exception ex) { ModelState.AddModelError("", ex.Message); return(PartialView()); } }//Category_Create for post end
public ActionResult Products() { var list = AutoEntityMap <Products, ProductsView> .EntityMap(base.ProductsBLL.Where().ToList()); return(View(list)); }