public bool FinalizarConfecao(Confecao c)
        {
            var u = _context.utilizadores.Find(c.utilizador);

            if (u == null)
            {
                return(false);
            }
            u.AdicionaConfecaoDeReceita(c);
            _context.Entry(c).State = EntityState.Modified;
            _context.SaveChanges();
            return(true);
        }
示例#2
0
        public async Task <IActionResult> IniciaConfecao(int receitaId)
        {
            Confecao c = new Confecao(receitaId);

            _context.confecoes.Add(c);
            await _context.SaveChangesAsync();

            c = _context.confecoes
                .Where(conf => conf.id == c.id)
                .Include(conf => conf.receita)
                .Include(conf => conf.receita.passos)
                .Include("receita.passos.ingredientes.ingrediente")
                .First();
            return(CreatedAtAction(nameof(GetById), new { c.id }, c));
        }
 public bool IniciarConfecao(Confecao c)
 {
     _context.confecoes.Add(c);
     _context.SaveChanges();
     return(true);
 }
 public ConfecaoDto(Confecao c)
 {
     confecao = c;
     pre      = true;
 }