public async Task ChangeRepairStatus(RepairStatusModel status) { var repair = await _context.Repairs.FirstOrDefaultAsync(x => x.RepairId == status.RepairId); if (repair == null) { throw new Exception("Repair not found"); } repair.Status = status.Status; await _context.SaveChangesAsync(); }
public async Task <IActionResult> ChangeRepairStatus([FromBody] RepairStatusModel model) { try { await _repairsRepository.ChangeRepairStatus(model); return(Json( new { Success = true, Data = "ok" })); } catch (Exception exception) { return(Json(new { Success = false, exception.Message })); } }