Exemplo n.º 1
0
        public async Task <IActionResult> PutKnowledgeBaseEngineer(string id, KnowledgeBaseEngineer knowledgeBaseEngineer)
        {
            if (id != knowledgeBaseEngineer.Id)
            {
                return(BadRequest());
            }

            _context.Entry(knowledgeBaseEngineer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KnowledgeBaseEngineerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <KnowledgeBaseEngineer> > PostKnowledgeBaseEngineer(KnowledgeBaseEngineer knowledgeBaseEngineer)
        {
            _context.Engineers.Add(knowledgeBaseEngineer);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (KnowledgeBaseEngineerExists(knowledgeBaseEngineer.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetKnowledgeBaseEngineer", new { id = knowledgeBaseEngineer.Id }, knowledgeBaseEngineer));
        }