コード例 #1
0
        public ActionResult GetActivityStores(int activityId)
        {
            // 获取店铺权限
            var storeIds = _storeContract.QueryManageStoreId(AuthorityHelper.OperatorId.Value);

            if (storeIds == null)
            {
                return(Json(OperationResult.Error("店铺权限不足")));
            }

            // 获取活动
            var activity = _memberActivityContract.View(activityId);

            if (activity == null)
            {
                return(Json(OperationResult.Error("活动不存在")));
            }

            // 获取参与店铺
            if (activity.IsAllStore)
            {
                return(Json(new OperationResult(OperationResultType.Success, string.Empty, storeIds)));
            }
            else if (string.IsNullOrEmpty(activity.StoreIds))
            {
                return(Json(OperationResult.Error("该活动未设置参与店铺")));
            }
            else
            {
                var idArr    = activity.StoreIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(id => int.Parse(id));
                var resultId = idArr.Intersect(storeIds);
                return(Json(new OperationResult(OperationResultType.Success, string.Empty, resultId)));
            }
        }
コード例 #2
0
        public ActionResult View(int Id)
        {
            var result = _memberActivityContract.View(Id);

            return(PartialView(result));
        }