public ActionResult <DtoZoneListItem> Edit([FromBody] DtoZoneListItem value) { var edited = zoneManager.EditZone(value); if (edited != null) { return(Ok(edited)); } return(BadRequest()); }
private Zone DtoZoneToZone(DtoZoneListItem zone) { if (zone == null) { return(null); } return(new Zone() { Id = zone.Id, Name = zone.Name }); }
protected async Task GetZones() { DtoZoneListItem[] loadedZones = await Http.GetJsonAsync <DtoZoneListItem[]>(baseUrl + "zones"); if (loadedZones != null && loadedZones.Length > 0) { zones = loadedZones; selectedZone = zones[0]; } else { zones = null; } }
protected async Task ZoneSelectorChanged(ChangeEventArgs e) { int selectedId = Convert.ToInt32(e.Value); bool found = false; int i = 0; while (!found && i < zones.Length) { if (zones[i].Id == selectedId) { selectedZone = zones[i]; } i++; } await GetSensors(); }
public DtoZoneListItem EditZone(DtoZoneListItem zone) { var edited = zoneRepository.Update(DtoZoneToZone(zone)); return(ZoneToDtoZone(edited)); }