Пример #1
0
        public IActionResult Add([FromBody] Thing thing)
        {
            if (thing == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Thing newThing = _thingsRepository.Add(thing);

            return(CreatedAtRoute("GetSingleThing", new { id = newThing.Id }, newThing));
        }
Пример #2
0
 public void SetThing(Things thing)
 {
     _thingRepository.Add(thing);
 }