Beispiel #1
0
        public async Task InsertAsync(ProjetoPost projetoPost)
        {
            if (projetoPost == null)
            {
                throw new NotFoundException("Projeto inválido");
            }
            try
            {
                var projeto = new Projeto()
                {
                    Nome = projetoPost.Nome,
                };

                _context.Add(projeto);
                await _context.SaveChangesAsync();
            }
            catch (DBConcurrencyException e)
            {
                throw new DBConcurrencyException(e.Message);
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Create(ProjetoPost projeto)
        {
            await _projetoService.InsertAsync(projeto);

            return(NoContent());
        }