public ActionResult Shop(int?pageIndex) { var goodIds = ShopingServices.LoadEntities(s => s.UserInfoId == CurrentLoginUser.Id && s.DelFlag == normal); if (pageIndex == null || pageIndex <= 0) { pageIndex = 1; } List <Shops> list = new List <Shops>(); int total = 0; if (goodIds != null) { foreach (var item in goodIds) { Shops shop = new Shops(); int goodid = item.GoodsId; Goods good = GoodsServices.LoadPageEntities((int)pageIndex, 5, out total, u => u.Id == goodid , u => u.Id, true).FirstOrDefault(); shop.ShopId = item.Id; shop.Goods = good; list.Add(shop); } } ViewData["allGoods"] = list; ViewData["pageIndex"] = pageIndex; ViewData["Count"] = total; return(View()); }
public ActionResult DeleteShop(int id) { Shoping shop = ShopingServices.LoadEntities(s => s.Id == id).FirstOrDefault(); if (shop == null) { return(Content("数据错误,请刷新本页面")); } shop.DelFlag = delete; try { ShopingServices.Update(shop); return(Content("ok")); } catch (Exception) { return(Content("数据库错误,请联系管理员")); throw; } }