Exemplo n.º 1
0
        /// <summary>
        /// 设置排序
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public SetAdOrderResponse SetAdOrder(SetAdOrderRequest request)
        {
            using (var client = DbFactory.GetClient())
            {
                var ad = client.Queryable <Ad>().Select(it => new { it.Id }).First(it => it.Id == request.Id);
                if (ad == null)
                {
                    throw new MozException("找不到该条信息");
                }

                client.Updateable <Ad>()
                .UpdateColumns(it => new Ad {
                    OrderIndex = request.OrderIndex
                })
                .Where(it => it.Id == request.Id)
                .ExecuteCommand();

                return(new SetAdOrderResponse());
            }
        }
Exemplo n.º 2
0
        //[AdminAuthorize(Permissions = "admin.ad.setorderindex")]
        public IActionResult SetOrderIndex(SetAdOrderRequest request)
        {
            var resp = _adService.SetAdOrder(request);

            return(RespJson(resp));
        }