示例#1
0
        public IActionResult GetById(int id)
        {
            var item = StuffData.GetStuff(id);

            if (item == null)
            {
                return(NotFound());
            }
            return(new ObjectResult(item));
        }
示例#2
0
        public IActionResult Create([FromBody] StuffItem item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            StuffData.CreateStuff(item);

            item = StuffData.GetStuff(StuffData.GetMaxId());
            if (item == null)
            {
                return(NotFound());
            }
            return(new ObjectResult(item));;
        }
示例#3
0
 public IEnumerable <StuffItem> GetAll()
 {
     return(StuffData.GetStuff());
 }