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 | |
---|
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 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.