Esempio n. 1
0
        public async Task <ActionResult <ItemDataContract> > GetItem(int id)
        {
            DBRepository2           dBRepository2 = new DBRepository2();
            Task <ItemDataContract> item          = dBRepository2.GetItemByIdAsync(id);

            return(await item);
        }
Esempio n. 2
0
        public async Task <ActionResult <IEnumerable <BeforeBuying.Model.ItemDataContract> > > GetShop()
        {
            DBRepository2 dBRepository2 = new DBRepository2();

            return(await dBRepository2.GetAllItemsAsync());

            //return await _context.BlogPosts.ToListAsync();
        }
Esempio n. 3
0
        public async Task <ActionResult <Item> > PostBlogPost(Item item)
        {
            DBRepository2 dBRepository2 = new DBRepository2();

            //dBRepository2.InsertOrUpdateItem(item);
            //await dBRepository2.SaveAsync();

            return(CreatedAtAction("GetItem", new { id = item.Id }, item));
        }
Esempio n. 4
0
        public async Task <IActionResult> PutItemPost(int id, Item item)
        {
            DBRepository2 dBRepository2 = new DBRepository2();

            try
            {
                //dBRepository2.InsertOrUpdateItem(item);
                //await dBRepository2.SaveAsync();
            }
            catch (Exception ex)
            {
                throw ex;
                //if (!ItemPostExists(id))
                //{
                //    return NotFound();
                //}
                //else
                //{
                //    throw;
                //}
            }

            return(NoContent());
        }