Ejemplo n.º 1
0
        public ResponseItem Put(yy_Product value)
        {
            var _Entity = DB.yy_Product.Find(value.ID);
            if (_Entity != null)
            {
                _Entity.IsShow = value.IsShow;
                _Entity.ShowIndex = value.ShowIndex;
                _Entity.Title = value.Title;
                _Entity.KeyWords = value.KeyWords;
                _Entity.Summary = value.Summary;
                _Entity.TypeIDs = value.TypeIDs;

                if (!_Entity.Info.Equals(value.Info))
                {
                    value.Info = KeywordReplace.Excute(DB, value.Info, 2, value.TypeIDs);
                }

                _Entity.Info = value.Info;
                _Entity.TargetPlatforms = value.TargetPlatforms;
                _Entity.CanReply = value.CanReply;
                _Entity.CreateDate = value.CreateDate;
                DB.SaveChanges();

                return new ResponseItem(0, "");
            }

            return new ResponseItem(2, "不存在的产品。");
        }
Ejemplo n.º 2
0
        public ResponseItem ShowHide(yy_Product value)
        {
            var _News = DB.yy_Product.Find(value.ID);
            if (_News != null)
            {
                _News.IsShow = value.IsShow;
                DB.SaveChanges();

                return new ResponseItem(0, "");
            }

            return new ResponseItem(2, "不存在的产品。");
        }
Ejemplo n.º 3
0
 public ResponseItem Post(yy_Product value)
 {
     try
     {
         value.Info = KeywordReplace.Excute(DB, value.Info, 2, value.TypeIDs);
         DB.yy_Product.Add(value);
         DB.SaveChanges();
         return new ResponseItem(0, "添加产品成功。");
     }
     catch (Exception ex)
     {
         return new ResponseItem(2, ex.Message);
     }
 }