public IActionResult Post(WeighingDTO weighing) { try { Weighings.Add(DTO.FromDTO(weighing)); return(Ok(weighing)); } catch { return(BadRequest()); } }
public IActionResult Put(int id, WeighingDTO weighing) { if (Weighings.Read(id) == null) { return(NotFound()); } try { Weighings.Edit(id, DTO.FromDTO(weighing)); return(Ok(weighing)); } catch { return(BadRequest()); } }