public ActionResult <DtoEditSchedule> Edit([FromBody] DtoEditSwitch value) { var edited = switchManager.EditSwitch(value); if (edited != null) { return(Ok(edited)); } return(BadRequest()); }
protected void SetEditSwitch(int id) { selectedId = id; bool found = false; int i = 0; while (!found && i < switches.Length) { if (switches[i].Id == selectedId) { editSwitch = new DtoEditSwitch() { Id = switches[i].Id, Name = switches[i].Name, Mac = switches[i].Mac, Ip = switches[i].Ip }; } i++; } }
public DtoEditSwitch EditSwitch(DtoEditSwitch _switch) { var dbSwitch = switchRepository.Update(new Switch() { Id = _switch.Id, Name = _switch.Name, Ip = _switch.Ip, Mac = _switch.Mac }); if (dbSwitch == null) { return(null); } return(new DtoEditSwitch() { Id = _switch.Id, Name = _switch.Name, Ip = _switch.Ip, Mac = _switch.Mac }); }