source: resTools_backend/backend/Controllers/MenuController.cs

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

vip functionallity + menu fields + alergens filtering + google/fb login + email queueing

  • Property mode set to 100644
File size: 1.0 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 MenuController : ControllerBase
14{
15 private readonly IMenuService _menuService = null;
16
17 public MenuController(IMenuService menuService)
18 {
19 _menuService = menuService;
20 }
21
22 [Authorize]
23 [HttpPost()]
24 public async Task<IActionResult> CreateMenuItem([FromBody] CreateMenuItemRequest req)
25 {
26 await _menuService.AddMenu(req);
27 return Ok();
28 }
29
30 [Authorize]
31 [HttpDelete("{id}")]
32 public async Task<IActionResult> DeleteMenuItem(int id)
33 {
34 await _menuService.RemoveMenu(id);
35 return Ok();
36 }
37
38 [HttpPost("{id}/upload")]
39 public async Task<IActionResult> UploadImage(int id, [FromForm] IFormFile file)
40 {
41 await _menuService.UploadImage(id, file);
42 return Ok();
43 }
44}
Note: See TracBrowser for help on using the repository browser.