public async Task <IActionResult> PutEtransformer(short id, Etransformer etransformer) { if (id != etransformer.EtransformerId) { return(BadRequest()); } _context.Entry(etransformer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EtransformerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Etransformer> > PostEtransformer(Etransformer etransformer) { _context.Etransformer.Add(etransformer); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EtransformerExists(etransformer.EtransformerId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEtransformer", new { id = etransformer.EtransformerId }, etransformer)); }