/// <summary> /// 获取当前门店商品分类列表 /// </summary> private List <SelectListItem> GetGoodsCategoryList(int ShopId) { IGoodsCategoryBLL goodsCategoryBLL = BLLFactory <IGoodsCategoryBLL> .GetBLL("GoodsCategoryBLL"); var sortModel = this.SettingSorting("Id", true); var list = goodsCategoryBLL.GetList(u => u.ShopId == ShopId, sortModel.SortName, sortModel.IsAsc); //转换为下拉列表并返回 return(list.Select(m => new SelectListItem() { Text = m.Name, Value = m.Id.ToString(), Selected = false }).ToList()); }
public ApiResultModel GetGoodsCategoryList([FromUri] DetailSearchModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //根据用户ID查找业主 IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL"); T_User owner = ownerBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果业主存在 if (owner != null) { //如果验证Token不通过或已过期 if (DateTime.Now > owner.TokenInvalidTime || model.Token != owner.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 owner.LatelyLoginTime = DateTime.Now; owner.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); ownerBll.Update(owner); //该门店的商品类别 Expression <Func <T_GoodsCategory, bool> > where = s => s.ShopId == model.Id; //获取指定门店的类别列表 IGoodsCategoryBLL categoryBll = BLLFactory <IGoodsCategoryBLL> .GetBLL("GoodsCategoryBLL"); resultModel.result = categoryBll.GetList(where).Select(s => new { CategoryId = s.Id, CategoryName = s.Name }); } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }