forked from MDCPS/DamageAssessment_Backend
Adding endpoint for mutiple questions update
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using DamageAssesment.Api.Questions.Interfaces;
|
||||
using DamageAssesment.Api.Questions.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DamageAssesment.Api.Questions.Controllers
|
||||
@ -108,6 +109,27 @@ namespace DamageAssesment.Api.Questions.Controllers
|
||||
}
|
||||
return CreatedAtRoute("DefaultApi",questions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// POST request for creating a multiple question (multilingual).
|
||||
/// </summary>
|
||||
[HttpPost("questions/multiple/{surveyid}")]
|
||||
public async Task<IActionResult> UpdateQuestions(int surveyid, List<Models.Question> questions)
|
||||
{
|
||||
if (questions != null)
|
||||
{
|
||||
var result = await this.questionsProvider.PutQuestionsAsync(surveyid,questions);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
return Ok(result.Question);
|
||||
}
|
||||
if (result.ErrorMessage == "Not Found")
|
||||
return NotFound(result.ErrorMessage);
|
||||
|
||||
return BadRequest(result.ErrorMessage);
|
||||
}
|
||||
return CreatedAtRoute("DefaultApi", questions);
|
||||
}
|
||||
/// <summary>
|
||||
/// POST request for creating a new question (multilingual).
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user