示例#1
0
        public async Task <IActionResult> PutTypeOfBread(string id, TypeOfBread typeOfBread)
        {
            if (id != typeOfBread.Name)
            {
                return(BadRequest());
            }

            _context.Entry(typeOfBread).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TypeOfBreadExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public SubwaySandwich OrderSandwich(TypeOfSubway subway, TypeOfBread bread, BreadSize size)
        {
            var subwayRecipe = CreateSandwich(subway);

            subwayRecipe.Prepare(subway, bread, size);

            return(subwayRecipe);
        }
示例#3
0
 public override void Prepare(TypeOfSubway subway, TypeOfBread bread, BreadSize size)
 {
     RecipeName = "Veggie Delite";
     Bread      = bread;
     Size       = size;
     Proteins   = subwayRecipe.ChooseProteins(subway);
     Cheeses    = subwayRecipe.AddCheese(subway);
     Veggies    = subwayRecipe.AddVeggies(subway);
     Sauces     = subwayRecipe.AddSauces(subway);
 }
示例#4
0
 public override void Prepare(TypeOfSubway subway, TypeOfBread bread, BreadSize size)
 {
     RecipeName = "Sweet Onion Chicken Teriyaki";
     Bread      = bread;
     Size       = size;
     Proteins   = subwayRecipe.ChooseProteins(subway);
     Cheeses    = subwayRecipe.AddCheese(subway);
     Veggies    = subwayRecipe.AddVeggies(subway);
     Sauces     = subwayRecipe.AddSauces(subway);
 }
示例#5
0
        public async Task <ActionResult <TypeOfBread> > PostTypeOfBread(TypeOfBread typeOfBread)
        {
            _context.TypeOfBread.Add(typeOfBread);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TypeOfBreadExists(typeOfBread.Name))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTypeOfBread", new { id = typeOfBread.Name }, typeOfBread));
        }
示例#6
0
 public abstract void Prepare(TypeOfSubway subway, TypeOfBread bread, BreadSize size);