示例#1
0
        public async Task <IActionResult> GetAsync(int id)
        {
            if (id < 1)
            {
                return(BadRequest(new List <string> {
                    "Id can not be less than 1."
                }));
            }

            var entity = await _dataService.GetByIdOrDefaultAsync(id);

            if (entity == null)
            {
                return(NotFound());
            }

            return(Ok(entity));
        }