public async Task <IActionResult> Update(long id, batteries battery) { var bat = _context.batteries.Find(id); if (bat == null) { return(NotFound()); } bat.status = battery.status; _context.batteries.Update(bat); _context.SaveChanges(); var json = new JObject(); json["message"] = "the change of el status is well done"; return(Content(json.ToString(), "application/json")); }
public IActionResult Update(long id, batteries battery) { var bat = _context.batteries.Find(id); if (bat == null) { return(NotFound()); } bat.Status = battery.Status; _context.batteries.Update(bat); _context.SaveChanges(); var json = new JObject(); json["New Status"] = battery.Status; json["message"] = "The Status of the Battery Id: " + bat.id + " has been changed to: " + bat.Status; return(Content(json.ToString(), "application/json")); }