Example #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());
        }
Example #2
0
        public SubwaySandwich OrderSandwich(TypeOfSubway subway, TypeOfBread bread, BreadSize size)
        {
            var subwayRecipe = CreateSandwich(subway);

            subwayRecipe.Prepare(subway, bread, size);

            return(subwayRecipe);
        }
Example #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);
 }
Example #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);
 }
Example #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));
        }
Example #6
0
 public abstract void Prepare(TypeOfSubway subway, TypeOfBread bread, BreadSize size);