public static async Task <IActionResult> Put <T>(this Controller controller, IRest <T> rest, int id, T value) { if (!controller.ModelState.IsValid || value == null) { return(controller.BadRequest(controller.ModelState)); } try { if (rest.CompareId(id, value) == false) { return(controller.BadRequest("Missmatch between id and machineID")); } await rest.Update(id, value); return(controller.StatusCode(204)); } catch (Exception ex) { return(controller.BadRequest(ex.Message)); } }