コード例 #1
0
        public IActionResult Delete(int id)
        {
            Store_Inventory delete = _context.store_inventory.Where(c => c.store_id == id).FirstOrDefault();

            _context.store_inventory.Remove(delete);
            _context.SaveChanges();
            return(Ok(delete));
        }
コード例 #2
0
 public IActionResult Post([FromBody] Store_Inventory inventory)
 {
     if (inventory == null)
     {
         return(NotFound());
     }
     _context.store_inventory.Add(inventory);
     _context.SaveChanges();
     return(Ok(inventory));
 }
コード例 #3
0
        public ActionResult GetById(int id)
        {
            Store_Inventory store = _context.store_inventory.Where(c => c.store_id == id).FirstOrDefault();

            if (store == null)
            {
                return(NotFound());
            }
            return(Ok(store));
        }
コード例 #4
0
        public IActionResult Put(int id, [FromBody] Store_Inventory inventory)
        {
            Store_Inventory delete = _context.store_inventory.Where(c => c.store_id == id).FirstOrDefault();

            if (inventory == null || delete == null)
            {
                return(NotFound());
            }

            _context.store_inventory.Remove(delete);
            _context.store_inventory.Add(inventory);
            _context.SaveChanges();

            return(Ok(inventory));
        }