Exemplo n.º 1
0
 public IActionResult Post(WeighingDTO weighing)
 {
     try
     {
         Weighings.Add(DTO.FromDTO(weighing));
         return(Ok(weighing));
     }
     catch
     {
         return(BadRequest());
     }
 }
Exemplo n.º 2
0
 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());
     }
 }