life quality changes
- refactored SurveyController.cs - added ProducesResponseType to every endpoint in every controller - remade mappers
This commit is contained in:
parent
9e50b97bc9
commit
6692a91821
11 changed files with 146 additions and 93 deletions
28
SurveyBackend/SurveyBackend.API/Mappers/SurveyMapper.cs
Normal file
28
SurveyBackend/SurveyBackend.API/Mappers/SurveyMapper.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using SurveyBackend.DTOs.Survey;
|
||||
using SurveyLib.Core.Models;
|
||||
|
||||
namespace SurveyBackend.Mappers;
|
||||
|
||||
public static class SurveyMapper
|
||||
{
|
||||
public static Survey CreateDtoToModel(CreateSurveyDto dto, int userId)
|
||||
{
|
||||
return new Survey
|
||||
{
|
||||
Title = dto.Title,
|
||||
Description = dto.Description,
|
||||
CreatedBy = userId
|
||||
};
|
||||
}
|
||||
|
||||
public static OutputSurveyDto ModelToOutputDto(Survey survey)
|
||||
{
|
||||
return new OutputSurveyDto
|
||||
{
|
||||
Id = survey.Id,
|
||||
Title = survey.Title,
|
||||
Description = survey.Description,
|
||||
CreatedBy = survey.CreatedBy,
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue