Пример #1
0
        public ExecuteResult<TagInfoResponse> Get(TagGetRequest request)
        {
            if (request == null)
            {
                return new ExecuteResult<TagInfoResponse>(null) { StatusCode = StatusCode.ClientError, Message = "参数错误" };
            }

            var entity = this._tagRepository.GetItem(request.TagId);

            return new ExecuteResult<TagInfoResponse>(MappingManager.TagInfoResponseMapping(entity));
        }
Пример #2
0
 /// <summary>
 /// return request tag's available properties
 /// </summary>
 /// <param name="request"></param>
 /// <param name="authUser"></param>
 /// <returns></returns>
 public ActionResult Property(TagGetRequest request, UserModel authUser)
 {
     var linq = Context.Set<CategoryPropertyEntity>().Where(c => c.CategoryId == request.TagId && c.Status == (int)DataStatus.Normal)
                 .GroupJoin(Context.Set<CategoryPropertyValueEntity>().Where(pv => pv.Status == (int)DataStatus.Normal),
                         o => o.Id,
                         i => i.PropertyId,
                         (o, i) => new { P = o, PV = i })
                 .OrderByDescending(p => p.P.SortOrder);
     var result = linq.ToList()
                 .Select(l => new TagPropertyDetailResponse().FromEntity<TagPropertyDetailResponse>(l.P, p => {
                     p.PropertyId = l.P.Id;
                     p.PropertyName = l.P.PropertyDesc;
                     p.Values = l.PV.Select(pv => new TagPropertyValueDetailResponse() { 
                          ValueId = pv.Id,
                           ValueName =pv.ValueDesc
                     });
                 }));
     var response = new PagerInfoResponse<TagPropertyDetailResponse>(new PagerRequest(), result.Count())
     {
         Items = result.ToList()
     };
     return new RestfulResult { Data = new ExecuteResult<PagerInfoResponse<TagPropertyDetailResponse>>(response) };
 }
Пример #3
0
 public RestfulResult Detail(TagGetRequest request)
 {
     Logger.Debug(string.Format("request channel:{0}", request.Channel));
     return new RestfulResult { Data = this._tagDataService.Get(request) };
 }