public List <Barbecue> GetAllDefaultBarbecues() { var list = new List <Barbecue>(); var barbecueOne = new Barbecue( title: "Churras Carnaval 1", date: DateTime.Now.AddDays(1).Date, description: "Vamos comemorar todos juntos nessa folia de sexta-feira 1!", costWithDrink: 20, costWithoutDrink: 10 ); barbecueOne.Id = 1; var barbecueTwo = new Barbecue( title: "Churras Carnaval 2", date: DateTime.Now.AddDays(2).Date, description: "Vamos comemorar todos juntos nessa folia de sexta-feira 2!", costWithDrink: 30, costWithoutDrink: 20 ); barbecueTwo.Id = 2; var participantOne = new Participant(barbecueTwo, "Participante 1", 100, true); participantOne.Id = 1; barbecueTwo.AddParticipant(participantOne); list.Add(barbecueOne); list.Add(barbecueTwo); return(list); }
public static void AddTestData(this ChurrasContext context) { var firstBarbecue = new Barbecue( title: "Churras Carnaval 1", date: DateTime.Now.AddDays(1).Date, description: "Vamos comemorar todos juntos nessa folia de sexta-feira 1!", costWithDrink: 20, costWithoutDrink: 10 ); context.Barbecues.Add(firstBarbecue); var secondBarbecue = new Barbecue( title: "Churras Carnaval 2", date: DateTime.Now.AddDays(2).Date, description: "Vamos comemorar todos juntos nessa folia de sexta-feira 2!", costWithDrink: 30, costWithoutDrink: 20 ); secondBarbecue.AddParticipant(new Participant(secondBarbecue, "Participante 1", 100, true)); context.Barbecues.Add(secondBarbecue); context.SaveChanges(); Console.WriteLine("TestData: Added"); }