コード例 #1
0
        public ActionResult EditGift(PointGiftEditModel model)
        {
            PointGift pointGift = model.AsPointGift();

            if (pointGift.GiftId > 0)
            {
                pointMallService.UpdateGift(pointGift);

                categoryService.ClearCategoriesFromItem(pointGift.GiftId, 0, TenantTypeIds.Instance().PointGift());
            }
            else
            {
                if (!pointMallService.CreateGift(pointGift))
                {
                    return(Json(new StatusMessageData(StatusMessageType.Error, "添加商品失败!")));
                }
            }

            //添加类别
            categoryService.AddItemsToCategory(new List <long>()
            {
                pointGift.GiftId
            }, model.CategoryId);
            return(Json(new StatusMessageData(StatusMessageType.Success, model.GiftId > 0 ? "编辑商品成功!" : "添加商品成功!")));
        }
コード例 #2
0
        public ActionResult EditGift(long giftId = 0)
        {
            string title = giftId > 0 ? "编辑商品" : "添加商品";

            pageResourceManager.InsertTitlePart(title);

            pageResourceManager.AppendTitleParts(title);

            PointGiftEditModel pointGiftEditModel = new PointGiftEditModel();

            if (giftId > 0)
            {
                pointGiftEditModel = pointMallService.GetGift(giftId).AsPointGiftEditModel();
            }
            return(View(pointGiftEditModel));
        }