コード例 #1
0
        public async Task <Barbeque> UpdateAsync(int id, AddBarbequeModel updatedBbq)
        {
            Barbeque bbq = new Barbeque(updatedBbq.Description, updatedBbq.EventDateTime);

            bbq.Id = id;
            return(await _barbequeRepository.Update(bbq));
        }
コード例 #2
0
        public async Task <Barbeque> Update(Barbeque barbeque)
        {
            _context.Barbeques.Update(barbeque);
            await _context.SaveChangesAsync(true);

            return(barbeque);
        }
コード例 #3
0
        public async Task <bool> Remove(Barbeque barbeque)
        {
            _context.Barbeques.Remove(barbeque);
            await _context.SaveChangesAsync(true);

            return(true);
        }
コード例 #4
0
        public async Task <Barbeque> AddAsync(Barbeque barbeque)
        {
            await _context.Barbeques.AddAsync(barbeque);

            await _context.SaveChangesAsync(true);

            return(barbeque);
        }
コード例 #5
0
    public void Run()
    {
        margueritta pizza       = new margueritta();
        freshtomato freshtomato = new freshtomato(pizza);

        chickenfiesta pizza2   = new chickenfiesta();
        Barbeque      barbeque = new Barbeque(pizza2);

        Console.WriteLine("Preços:");
        Console.WriteLine("Pizza: {0}, {1} R$. Adicional: {2}, {3} R$.",
                          pizza.nome, pizza.GetCost(), freshtomato.nome, freshtomato.GetfreshtomatoCost());
        Console.WriteLine("Pizza: {0}, {1} R$. Adicional: {2}, {3} R$.",
                          pizza2.nome, pizza2.GetCost(), barbeque.nome, barbeque.GetBarbequeCost());

        Console.WriteLine("Pedidos:");
        Console.WriteLine("Pizza: {0} com adicional: {1}. Preço total: {2} R$.",
                          pizza.nome, freshtomato.nome, freshtomato.GetCost());
        Console.WriteLine("Pizza: {0} com adicional: {1}. Preço total: {2} R$.",
                          pizza2.nome, barbeque.nome, barbeque.GetCost());
    }
コード例 #6
0
        public async Task <bool> DeleteAsync(int id)
        {
            Barbeque bbq = await _barbequeRepository.FindByIdAsync(id);

            return(await _barbequeRepository.Remove(bbq));
        }
コード例 #7
0
        public async Task <Barbeque> AddAsync(AddBarbequeModel insertedBbq)
        {
            Barbeque bbq = new Barbeque(insertedBbq.Description, insertedBbq.EventDateTime);

            return(await _barbequeRepository.AddAsync(bbq));
        }