public async Task <IActionResult> PutElectricalEquipment(int id, ElectricalEquipment electricalEquipment) { if (id != electricalEquipment.Id) { return(BadRequest()); } this.db.Entry(electricalEquipment).State = EntityState.Modified; try { await this.db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ElectricalEquipmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ElectricalEquipment> > PostElectricalEquipment(ElectricalEquipment electricalEquipment) { this.db.ElectricalEquipments.Add(electricalEquipment); await this.db.SaveChangesAsync(); return(CreatedAtAction("GetElectricalEquipment", new { id = electricalEquipment.Id }, electricalEquipment)); }