Skip to content
Snippets Groups Projects
Commit 1d8baf26 authored by esantangelo's avatar esantangelo
Browse files

fix

parent 584eac2d
No related branches found
No related tags found
2 merge requests!26Develop,!23Feature/survey
......@@ -59,5 +59,6 @@ namespace Tsi1.BusinessLayer.Helpers
public const string SurveyIsNull = "La encuesta es nula";
public const string SurveyHasNoQuestions = "La encuesta no tiene preguntas";
public const string InvalidSurvey = "La encuesta no pertenece a la facultad con id '{0}'";
public const string SurveyResponseAlreadyExist = "El usuario '{0}' ya completo la encuesta '{1}'";
}
}
......@@ -154,14 +154,15 @@ namespace Tsi1.BusinessLayer.Services
if (existingSurveyResponse != null)
{
_mapper.Map(surveyResponse, existingSurveyResponse);
}
else
{
var newSurveyResponse = _mapper.Map<SurveyResponse>(surveyResponse);
_context.Add(newSurveyResponse);
result.HasError = true;
result.AddMessage(string.Format(ErrorMessages.SurveyResponseAlreadyExist, surveyResponse.UserId, surveyResponse.SurveyId));
return result;
}
var newSurveyResponse = _mapper.Map<SurveyResponse>(surveyResponse);
_context.Add(newSurveyResponse);
await _context.SaveChangesAsync();
return result;
......@@ -172,7 +173,6 @@ namespace Tsi1.BusinessLayer.Services
var result = new ServiceResult<List<SurveyResponseDetailDto>>();
var tenant = await _context.Tenants.FirstOrDefaultAsync(x => x.Id == tenantId);
var tenantAdmin = await _context.Tenants.FirstOrDefaultAsync(x => x.Name == TenantAdmin.Name);
if (tenant == null)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment