예제 #1
0
        public IHttpActionResult RecordTag(TagDto tagDto)
        {
            TempStorageTag tst = new TempStorageTag
            {
                IdNo      = tagDto.IdNo,
                Name      = tagDto.TagName,
                Action    = tagDto.Action,
                TimeStamp = DateTime.Now,
                UserId    = userId
            };

            _db.TempStorageTags.Add(tst);
            _db.SaveChanges();
            return(Ok());
        }
예제 #2
0
        public IHttpActionResult RemoveTag(TagDto tagDto)
        {
            TempStorageTag tst = _db.TempStorageTags
                                 .Where(x => x.Name == tagDto.TagName &&
                                        x.UserId == userId &&
                                        x.IdNo == tagDto.IdNo)
                                 //                        && x.Action == ProjectAction.Create)
                                 .FirstOrDefault();

            if (tst == null)
            {
                return(BadRequest("No such temp tag"));
            }

            _db.Entry(tst).State = EntityState.Deleted;
            _db.SaveChanges();

            return(Ok());
        }