source: resTools_backend/backend/Controllers/RestaurantsController.cs

Last change on this file was 899b19d, checked in by Danilo <danilo.najkov@…>, 2 years ago

reviews full feature

  • Property mode set to 100644
File size: 1.3 KB
Line 
1namespace backend.Controllers;
2
3using backend.DTOs;
4using backend.Entities;
5using backend.Helpers;
6using backend.Models;
7using backend.Services;
8using Microsoft.AspNetCore.Mvc;
9using System.Security.Claims;
10
11[ApiController]
12[Route("[controller]")]
13public class RestaurantsController : ControllerBase
14{
15 private readonly IRestaurantService _restaurantService = null;
16
17 public RestaurantsController(IRestaurantService restaurantService)
18 {
19 _restaurantService = restaurantService;
20 }
21
22 /*
23 [Authorize]
24 [HttpPost()]
25 public async Task<IActionResult> CreateRestaurant([FromQuery] string title)
26 {
27 var userId = (int) this.HttpContext.Items["User"];
28 await _restaurantService.CreateRestaurant(title, userId);
29
30
31 return Ok();
32 }
33 */
34
35 [HttpGet()]
36 public async Task<RestaurantResponse> GetRestaurant()
37 {
38 var response = await _restaurantService.GetRestaurant();
39 return response;
40 }
41
42 [HttpPost("upload")]
43 public async Task<IActionResult> UploadImage([FromForm] IFormFile file)
44 {
45 await _restaurantService.UploadImage(file);
46 return Ok();
47 }
48
49 [Authorize]
50 [HttpPut()]
51 public async Task<IActionResult> UpdateRestaurant([FromBody] UpdateRestaurantRequest req)
52 {
53 await _restaurantService.UpdateRestaurant(req);
54 return Ok();
55 }
56}
Note: See TracBrowser for help on using the repository browser.