public async Task <IActionResult> PutTelectrificationSystem(long id, TelectrificationSystem telectrificationSystem) { if (id != telectrificationSystem.TelectrificationSystemId) { return(BadRequest()); } _context.Entry(telectrificationSystem).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TelectrificationSystemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TelectrificationSystem> > PostTelectrificationSystem(TelectrificationSystem telectrificationSystem) { _context.TelectrificationSystem.Add(telectrificationSystem); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TelectrificationSystemExists(telectrificationSystem.TelectrificationSystemId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTelectrificationSystem", new { id = telectrificationSystem.TelectrificationSystemId }, telectrificationSystem)); }