forked from muratyucedag/Doccure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueueController.txt
More file actions
40 lines (30 loc) · 1.05 KB
/
Copy pathQueueController.txt
File metadata and controls
40 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[HttpGet]
public async Task<IActionResult> GetQueueList()
{
var values = await _context.Queues
.OrderBy(x => x.QueueNumber)
.ToListAsync();
return Ok(values);
}
[HttpPost]
public async Task<IActionResult> CreateQueue(Queue queue)
{
queue.Status = "Waiting";
await _context.Queues.AddAsync(queue);
await _context.SaveChangesAsync();
return Ok("Hasta sýraya eklendi");
}
[HttpPost("call/{id}")]
public async Task<IActionResult> CallPatient(int id)
{
var patient = await _context.Queues.FindAsync(id);
if (patient == null)
return NotFound();
patient.Status = "Called";
await _context.SaveChangesAsync();
await _hubContext.Clients.All.SendAsync(
"PatientCalled",
patient.QueueNumber,
patient.PatientName);
return Ok("Hasta çaðrýldý");
}