Example #1
0
 public ShopstatInfo Save()
 {
     if (this.Shop_id != null)
     {
         Shopstat.Update(this);
         return(this);
     }
     return(Shopstat.Insert(this));
 }
Example #2
0
        public ActionResult Edit([FromQuery] uint Shop_id)
        {
            ShopstatInfo item = Shopstat.GetItem(Shop_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Example #3
0
        public APIReturn _Add([FromForm] uint?Shop_id, [FromForm] uint?Today_fav, [FromForm] uint?Today_session, [FromForm] uint?Today_share, [FromForm] uint?Total_fav, [FromForm] uint?Total_session, [FromForm] uint?Total_share)
        {
            ShopstatInfo item = new ShopstatInfo();

            item.Shop_id       = Shop_id;
            item.Today_fav     = Today_fav;
            item.Today_session = Today_session;
            item.Today_share   = Today_share;
            item.Total_fav     = Total_fav;
            item.Total_session = Total_session;
            item.Total_share   = Total_share;
            item = Shopstat.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Example #4
0
        public APIReturn _Del([FromForm] uint[] ids)
        {
            int affrows = 0;

            foreach (uint id in ids)
            {
                affrows += Shopstat.Delete(id);
            }
            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"删除成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Example #5
0
        public APIReturn _Edit([FromQuery] uint Shop_id, [FromForm] uint?Today_fav, [FromForm] uint?Today_session, [FromForm] uint?Today_share, [FromForm] uint?Total_fav, [FromForm] uint?Total_session, [FromForm] uint?Total_share)
        {
            ShopstatInfo item = Shopstat.GetItem(Shop_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.Today_fav     = Today_fav;
            item.Today_session = Today_session;
            item.Today_share   = Today_share;
            item.Total_fav     = Total_fav;
            item.Total_session = Total_session;
            item.Total_share   = Total_share;
            int affrows = Shopstat.Update(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Example #6
0
 public ShopstatInfo AddShopstat(uint?Today_fav, uint?Today_session, uint?Today_share, uint?Total_fav, uint?Total_session, uint?Total_share) => Shopstat.Insert(new ShopstatInfo {
     Shop_id       = this.Id,
     Today_fav     = Today_fav,
     Today_session = Today_session,
     Today_share   = Today_share,
     Total_fav     = Total_fav,
     Total_session = Total_session,
     Total_share   = Total_share
 });