예제 #1
0
 public static PizzaBox.Storing.Repositories.Pizzas Map(Domain.Pizzas pizza)
 {
     return(new PizzaBox.Storing.Repositories.Pizzas()
     {
         PizzaId = pizza.PizzaId,
         Crust = pizza.Crust,
         Size = pizza.Size,
         Username = pizza.Username,
         Price = pizza.Price
     });
 }
예제 #2
0
 public void AddPizza(Domain.Pizzas pizzas)
 {
     if (pdb.Pizzas.Any(e => e.PizzaId == pizzas.PizzaId) || pizzas.PizzaId == null)
     {
         Console.WriteLine($"This pizza {pizzas.PizzaId} is already in production, please select another");
         return;
     }
     else
     {
         pdb.Pizzas.Add(pizzas);
     }
     pdb.SaveChanges();
 }
예제 #3
0
 public void ModifyPizza(Domain.Pizzas pizzas)
 {
     if (pdb.Pizzas.Any(e => e.PizzaId == pizzas.PizzaId))
     {
         var piz = pdb.Pizzas.FirstOrDefault(e => e.PizzaId == pizzas.PizzaId);
         piz.Crust = pizzas.Crust;
         piz.Size  = pizzas.Size;
         pdb.Pizzas.Update(piz);
         pdb.SaveChanges();
     }
     else
     {
         Console.WriteLine($"Account with username {pizzas.PizzaId} does not exists, please ensure credentials have been typed correctly");
     }
 }