Ejemplo n.º 1
0
        // POST: api/GgcmsCategories
        public IHttpActionResult Add(GgcmsFriendLinks info)
        {
            var result = Dbctx.GgcmsFriendLinks.Add(info);

            UpFileClass.FileSave(info, info.files);
            Dbctx.SaveChanges();
            ClearCache();
            CacheHelper.RemoveAllCache(CacheTypeNames.Keys);
            return(Ok(result));
        }
Ejemplo n.º 2
0
        // PUT: api/GgcmsCategories/5
        public IHttpActionResult Edit(GgcmsFriendLinks info)
        {
            if (Dbctx.GgcmsFriendLinks.Where(x => x.Id == info.Id).Count() == 0)
            {
                return(BadRequest("信息不存在"));
            }
            UpFileClass.FileSave(info, info.files);
            //Dbctx.GgcmsFriendLinks.Attach(info);
            //Dbctx.Entry(info).Property("goods_name").IsModified = true;
            var ent = Dbctx.Entry(info);

            ent.State = EntityState.Modified;
            Dbctx.SaveChanges();
            ClearCache();
            CacheHelper.RemoveAllCache(CacheTypeNames.Keys);
            return(Ok(info));
        }
Ejemplo n.º 3
0
        // DELETE: api/GgcmsCategories/5
        public IHttpActionResult Delete(int id)
        {
            GgcmsFriendLinks oldinfo = Dbctx.GgcmsFriendLinks.Find(id);

            if (oldinfo == null)
            {
                return(BadRequest("信息不存在"));
            }

            //List<int> idlist = GetDeleteIds(oldinfo.ticket_key);

            //var query = Dbctx.ticket_information.Where(x => idlist.Contains(x.id));
            Dbctx.GgcmsFriendLinks.Remove(oldinfo);
            Dbctx.SaveChanges();
            ClearCache();
            CacheHelper.RemoveAllCache(CacheTypeNames.Keys);
            return(Ok(oldinfo));
        }