// GET: api/Employee public List <Item> GetItem() { using (var context = new ThinkBridgeDBEntities()) { var data = context.Items.ToList <Item>(); return(data); } }
// POST: api/Employee public Item Post(Item item) { using (var context = new ThinkBridgeDBEntities()) { var existingStudent = context.Items.Where(s => s.itemid == item.itemid).FirstOrDefault <Item>(); if (existingStudent != null) { existingStudent.itemname = item.itemname; existingStudent.price = item.price; existingStudent.description = item.description; context.SaveChanges(); } else { context.Items.Add(item); context.SaveChanges(); } } return(item); }