Example #1
0
        public ActionResult Edit(Guid?id = null)
        {
            Models.Discovery model = new Models.Discovery();
            if (id != null && id != Guid.Empty)
            {
                model = _currencyService.GetSingleById <Models.Discovery>(id);
            }

            ViewBag.RelationGoods = _discoveryService.GetDiscoveryRelationGoods(model.Id);
            return(View(model));
        }
Example #2
0
        public ApiResult Detail(Guid id)
        {
            var result    = new ApiResult();
            var discovery = _currencyService.GetSingleByConditon <Models.Discovery>(x => x.Id == id && x.Status == DiscoveryStatus.Normal);

            if (discovery != null)
            {
                var goods = _discoveryService.GetDiscoveryRelationGoods(id).Select(x => new DiscoveryRelationGoodsModel(x));
                var data  = new
                {
                    Detail        = new DiscoveryModel(discovery),
                    RelationGoods = goods
                };
                result.SetData(data);

                //添加阅读数
                discovery.ReadNum++;
                _currencyService.Update(discovery);
            }

            return(result);
        }