public async Task <ActionResult <ItemDataContract> > GetItem(int id) { DBRepository2 dBRepository2 = new DBRepository2(); Task <ItemDataContract> item = dBRepository2.GetItemByIdAsync(id); return(await item); }
public async Task <ActionResult <IEnumerable <BeforeBuying.Model.ItemDataContract> > > GetShop() { DBRepository2 dBRepository2 = new DBRepository2(); return(await dBRepository2.GetAllItemsAsync()); //return await _context.BlogPosts.ToListAsync(); }
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)); }
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()); }