public async Task <IActionResult> PostEditWheelApi(int id, [FromBody] Wheel wheel) { if (ModelState.IsValid) { try { wheel.WheelId = id; _context.Update(wheel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WheelExists(wheel.WheelId)) { return(NotFound()); } else { throw; } } return(Json("Success")); } return(Json("Fail")); }
public async Task <IActionResult> PostEditBatteryApi(int id, [FromBody] Battery battery) { if (ModelState.IsValid) { try { battery.BatteryId = id; _context.Update(battery); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BatteryExists(battery.BatteryId)) { return(NotFound()); } else { throw; } } return(Json("Success")); } return(Json("Fail")); }
public async Task <IActionResult> PostEditCardDetailsApi(int id, [FromBody] CardDetails cardDetails) { if (ModelState.IsValid) { try { cardDetails.CardId = id; _context.Update(cardDetails); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CardDetailsExists(cardDetails.CardId)) { return(NotFound()); } else { throw; } } return(Json("Success")); } return(Json("Fail")); }
public async Task <IActionResult> PostEditAccelerationModeApi(int id, [FromBody] AccelerationMode AccelerationMode) { if (ModelState.IsValid) { try { AccelerationMode.AccelerationModeId = id; _context.Update(AccelerationMode); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccelerationModeExists(AccelerationMode.AccelerationModeId)) { return(NotFound()); } else { throw; } } return(Json("Success")); } return(Json("Fail")); }
public async Task <IActionResult> PostEditPersonApi(int id, [FromBody] Person person) { if (ModelState.IsValid) { try { person.PersonId = id; _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.PersonId)) { return(NotFound()); } else { throw; } } return(Json("Success")); } return(Json("Fail")); }