-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
345 additions
and
642 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,70 @@ | ||
//using backend_MT.Models; | ||
//using backend_MT.Service.FeedbackService; | ||
//using Microsoft.AspNetCore.Mvc; | ||
using backend_MT.Models; | ||
using backend_MT.Models.DTOs; | ||
using backend_MT.Service.FeedbackService; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
//namespace backend_MT.Controllers | ||
//{ | ||
// [Route("api/[controller]")] | ||
// [ApiController] | ||
// public class FeedbackController : ControllerBase | ||
// { | ||
// private readonly IFeedbackService _feedbackService; | ||
namespace backend_MT.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class FeedbackController : ControllerBase | ||
{ | ||
private readonly IFeedbackService _feedbackService; | ||
|
||
// public FeedbackController(IFeedbackService feedbackService) | ||
// { | ||
// _feedbackService = feedbackService; | ||
// } | ||
public FeedbackController(IFeedbackService feedbackService) | ||
{ | ||
_feedbackService = feedbackService; | ||
} | ||
|
||
// // GET: api/feedback | ||
// [HttpGet] | ||
// public async Task<ActionResult<IEnumerable<Feedback>>> GetAllFeedbacks() | ||
// { | ||
// var feedbacks = await _feedbackService.GetAllFeedbacksAsync(); | ||
// return Ok(feedbacks); | ||
// } | ||
// GET: api/feedback | ||
[HttpGet] | ||
public async Task<ActionResult<IEnumerable<FeedbackDTO>>> GetAllFeedbacks() | ||
{ | ||
var feedbacks = await _feedbackService.GetAllFeedbacksAsync(); | ||
return Ok(feedbacks); | ||
} | ||
|
||
// // GET: api/feedback/{id} | ||
// [HttpGet("{id}")] | ||
// public async Task<ActionResult<Feedback>> GetFeedbackById(int id) | ||
// { | ||
// var feedback = await _feedbackService.GetFeedbackByIdAsync(id); | ||
// if (feedback == null) | ||
// { | ||
// return NotFound(); | ||
// } | ||
// return Ok(feedback); | ||
// } | ||
// GET: api/feedback/{id} | ||
[HttpGet("{id}")] | ||
public async Task<ActionResult<Feedback>> GetFeedbackById(int id) | ||
{ | ||
var feedback = await _feedbackService.GetFeedbackByIdAsync(id); | ||
if (feedback == null) | ||
{ | ||
return NotFound(); | ||
} | ||
return Ok(feedback); | ||
} | ||
|
||
// // POST: api/feedback | ||
// [HttpPost] | ||
// public async Task<ActionResult<Feedback>> AddFeedback(Feedback feedback) | ||
// { | ||
// await _feedbackService.AddFeedbackAsync(feedback); | ||
// return CreatedAtAction(nameof(GetFeedbackById), new { id = feedback.FeedbackId }, feedback); // Asumând că Feedback are o proprietate Id | ||
// } | ||
// POST: api/feedback | ||
[HttpPost] | ||
public async Task<ActionResult> AddFeedback(FeedbackDTO feedback) | ||
{ | ||
if (await _feedbackService.AddFeedbackAsync(feedback)) | ||
return Ok(); | ||
return BadRequest(); | ||
} | ||
|
||
// // PUT: api/feedback/{id} | ||
// [HttpPut("{id}")] | ||
// public async Task<IActionResult> UpdateFeedback(int id, Feedback feedback) | ||
// { | ||
// if (id != feedback.FeedbackId) // Verifică dacă ID-urile se potrivesc | ||
// { | ||
// return BadRequest(); | ||
// } | ||
// PUT: api/feedback/{id} | ||
[HttpPut("{id}")] | ||
public async Task<IActionResult> UpdateFeedback(int id, FeedbackDTO feedback) | ||
{ | ||
await _feedbackService.UpdateFeedbackAsync(id, feedback); | ||
return NoContent(); | ||
} | ||
|
||
// await _feedbackService.UpdateFeedbackAsync(feedback); | ||
// return NoContent(); | ||
// } | ||
// DELETE: api/feedback/{id} | ||
[HttpDelete("{id}")] | ||
public async Task<IActionResult> DeleteFeedback(int id) | ||
{ | ||
var feedback = await _feedbackService.GetFeedbackByIdAsync(id); | ||
if (feedback == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
// // DELETE: api/feedback/{id} | ||
// [HttpDelete("{id}")] | ||
// public async Task<IActionResult> DeleteFeedback(int id) | ||
// { | ||
// var feedback = await _feedbackService.GetFeedbackByIdAsync(id); | ||
// if (feedback == null) | ||
// { | ||
// return NotFound(); | ||
// } | ||
|
||
// await _feedbackService.DeleteFeedbackAsync(id); | ||
// return NoContent(); | ||
// } | ||
// } | ||
//} | ||
await _feedbackService.DeleteFeedbackAsync(id); | ||
return NoContent(); | ||
} | ||
} | ||
} |
Oops, something went wrong.