// GET: api/ToGoList/5
        public ToGo Get(int id)
        {
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
            ToGo   toGo  = db.ToGoes.First(a => a.Owner == owner && a.ID == id);

            return(toGo);
        }
Esempio n. 2
0
        // POST: api/ToGoList
        public void Post(ToGo ToGo)
        {
            string owner = ClaimsPrincipal.Current.FindFirst("name").Value;

            ToGo.Owner = owner;
            db.ToGoes.Add(ToGo);
        }
Esempio n. 3
0
        public async Task <IEnumerable <ToGo> > PostAsync(ToGo item)
        {
            StringContent content  = new StringContent(JsonConvert.SerializeObject(item));
            var           response = await client.PostAsync("/api/togolist", content);

            return(await GetAsync());
        }
        // POST: api/ToGoList
        public void Post(ToGo ToGo)
        {
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;

            ToGo.Owner = owner;
            db.ToGoes.Add(ToGo);
            db.SaveChanges();
        }
        // POST: api/ToGoList
        public void Post(ToGo ToGo)
        {
            //string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.Name).Value;

            ToGo.Owner = owner;
            _inMemList.Add(ToGo);
        }
        // DELETE: api/ToGoList/5
        public void Delete(int id)
        {
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
            ToGo   ToGo  = todoBag.First(a => a.Owner == owner && a.ID == id);

            if (ToGo != null)
            {
                //    todoBag.(ToGo);
            }
        }
        public void Put(ToGo ToGo)
        {
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
            ToGo   xToGo = todoBag.First(a => a.Owner == owner && a.ID == ToGo.ID);

            if (ToGo != null)
            {
                xToGo.Description = ToGo.Description;
            }
        }
        // DELETE: api/ToGoList/5
        public void Delete(int id)
        {
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
            ToGo   ToGo  = db.ToGoes.First(a => a.Owner == owner && a.ID == id);

            if (ToGo != null)
            {
                db.ToGoes.Remove(ToGo);
                db.SaveChanges();
            }
        }
        // DELETE: api/ToGoList/5
        public void Delete(int id)
        {
            //string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
            string owner = ClaimsPrincipal.Current.FindFirst(ClaimTypes.Name).Value;
            ToGo   ToGo  = _inMemList.First(a => a.Owner == owner && a.ID == id);

            if (ToGo != null)
            {
                _inMemList.Remove(ToGo);
            }
        }