コード例 #1
0
        public async Task <ItemDto> GetItem(string name)
        {
            using (Context db = new Context())
            {
                Item item = await db.Items.FirstOrDefaultAsync(x => x.Name == name);

                if (item == null)
                {
                    throw new Exception("Item not found");
                }
                return(itemMapper.CastDto(item));
            }
        }