public async Task <BreakfastItem> Post([FromBody] CreateOrUpdateBreakfastItemRequest request)
        {
            var item = new BreakfastItem
            {
                Name   = request.Name,
                Rating = request.Rating
            };
            await _context.BreakfastItems.AddAsync(item);

            await _context.SaveChangesAsync();

            return(item);
        }
        public async Task <IActionResult> Put(int id, [FromBody] CreateOrUpdateBreakfastItemRequest request)
        {
            var existing = await _context.BreakfastItems.FindAsync(id);

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

            existing.Name   = request.Name;
            existing.Rating = request.Rating;
            await _context.SaveChangesAsync();

            return(Ok(existing));
        }
 public static BreakfastItem GetCreatedBreakfastItem(this CreateOrUpdateBreakfastItemRequest request, int id) => new BreakfastItem
 {
     Id     = id,
     Name   = request.Name,
     Rating = request.Rating
 };