Last change
on this file since d76b7ee was d76b7ee, checked in by Danilo <danilo.najkov@…>, 3 years ago |
prototype final
|
-
Property mode
set to
100644
|
File size:
1.2 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 | [HttpPost()]
|
---|
30 | public async Task<IActionResult> CreateReservation([FromBody] CreateReservationRequest req)
|
---|
31 | {
|
---|
32 | await _reservationService.CreateReservation(req);
|
---|
33 | return Ok();
|
---|
34 | }
|
---|
35 |
|
---|
36 | [Authorize]
|
---|
37 | [HttpPut("{rid}")]
|
---|
38 | public async Task<IActionResult> ChangeStatus(int rid, [FromQuery] ReservationStatus status)
|
---|
39 | {
|
---|
40 | await _reservationService.ChangeReservationStatus(rid, status);
|
---|
41 | return Ok();
|
---|
42 | }
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.