Beispiel #1
0
        public ResultModel <string> DelProducts(SaveProductRQ rq)
        {
            var obj    = Product.FindById(rq.Id);
            int nCount = obj.Delete();

            return(new ResultModel <string>
            {
                state = nCount,
                message = nCount > 0 ? "删除成功!" : "操作失败!",
                data = nCount.ToString()
            });
        }
Beispiel #2
0
        /// <summary>
        /// 保存产品信息
        /// </summary>
        /// <param name="rq"></param>
        /// <returns></returns>
        public ResultModel <string> SaveProducts(SaveProductRQ rq)
        {
            EntityList <Product> users = new EntityList <Product>();
            var user = Product.FindById(rq.Id);

            if (null == user)
            {
                user = new Product();
                user.CreatedByName = rq.CreatedByName;
                user.CreatedOn     = DateTime.Now;
            }
            user.Banner         = rq.Banner;
            user.IsHot          = rq.IsHot;
            user.Logo           = rq.Logo;
            user.Price          = rq.Price;
            user.ProAge         = rq.ProAge;
            user.ProCase        = rq.ProCase;
            user.ProDoc         = rq.ProDoc;
            user.ProName        = rq.ProName;
            user.ProPlan        = rq.ProPlan;
            user.ProType        = rq.ProType;
            user.ProUse         = rq.ProUse;
            user.WhyChoose      = rq.WhyChoose;
            user.Status         = rq.Status;
            user.ModifiedByName = rq.CreatedByName;
            user.ModifiedOn     = DateTime.Now;
            user.Status         = rq.Status;
            users.Add(user);
            int nCount = users.Save();

            return(new ResultModel <string>
            {
                state = nCount,
                message = nCount > 0 ? "保存成功!" : "操作失败!",
                data = nCount.ToString()
            });
        }
Beispiel #3
0
 public ResultModel <string> SaveProducts(SaveProductRQ rq)
 {
     rq.CreatedByName = this.User.Identity.Name;
     return(_service.SaveProducts(rq));
 }
Beispiel #4
0
 public ResultModel <string> DelProducts(SaveProductRQ rq)
 {
     return(_service.DelProducts(rq));
 }