Last change
on this file was cc4db18, checked in by Danilo <danilo.najkov@…>, 2 years ago |
reservation module changes + contact module + menu module
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | namespace backend.Controllers;
|
---|
2 |
|
---|
3 | using backend.DTOs;
|
---|
4 | using backend.Entities;
|
---|
5 | using backend.Helpers;
|
---|
6 | using backend.Models;
|
---|
7 | using backend.Services;
|
---|
8 | using Microsoft.AspNetCore.Mvc;
|
---|
9 | using System.Security.Claims;
|
---|
10 |
|
---|
11 | [ApiController]
|
---|
12 | [Route("[controller]")]
|
---|
13 | public class ReservationsController : ControllerBase
|
---|
14 | {
|
---|
15 | private readonly IReservationService _reservationService = null;
|
---|
16 |
|
---|
17 | public ReservationsController(IReservationService reservationService)
|
---|
18 | {
|
---|
19 | _reservationService = reservationService;
|
---|
20 | }
|
---|
21 |
|
---|
22 | [Authorize]
|
---|
23 | [HttpGet()]
|
---|
24 | public async Task<List<ReservationResponse>> GetReservations([FromQuery] DateTime from, [FromQuery] DateTime to)
|
---|
25 | {
|
---|
26 | return await _reservationService.GetReservatins(from, to);
|
---|
27 | }
|
---|
28 |
|
---|
29 | [Authorize]
|
---|
30 | [HttpGet("new")]
|
---|
31 | public async Task<List<ReservationResponse>> GetReservationsNew()
|
---|
32 | {
|
---|
33 | return await _reservationService.GetNewReservations();
|
---|
34 | }
|
---|
35 |
|
---|
36 | [HttpPost()]
|
---|
37 | public async Task<IActionResult> CreateReservation([FromBody] CreateReservationRequest req)
|
---|
38 | {
|
---|
39 | await _reservationService.CreateReservation(req);
|
---|
40 | return Ok();
|
---|
41 | }
|
---|
42 |
|
---|
43 | [Authorize]
|
---|
44 | [HttpPut("{rid}/status")]
|
---|
45 | public async Task<IActionResult> ChangeStatus(int rid, [FromQuery] ReservationStatus status)
|
---|
46 | {
|
---|
47 | await _reservationService.ChangeReservationStatus(rid, status);
|
---|
48 | return Ok();
|
---|
49 | }
|
---|
50 |
|
---|
51 | [Authorize]
|
---|
52 | [HttpPut("{rid}/table")]
|
---|
53 | public async Task<IActionResult> ChangeTable(int rid, [FromQuery] int tableId)
|
---|
54 | {
|
---|
55 | await _reservationService.AssignTable(tableId, rid);
|
---|
56 | return Ok();
|
---|
57 | }
|
---|
58 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.