forked from MDCPS/DamageAssessment_Backend
		
	Revert "Merged PR 53: fixed survey put issue, and added export excel in responses
fixed survey put issue, amd added export excel in responses"
This commit is contained in:
		| @ -8,12 +8,10 @@ namespace DamageAssesment.Api.Responses.Controllers | ||||
|     public class SurveyResponsesController : ControllerBase | ||||
|     { | ||||
|         private readonly ISurveysResponse surveyResponseProvider; | ||||
|         private readonly IExcelExportService excelExportService; | ||||
|  | ||||
|         public SurveyResponsesController(ISurveysResponse surveyResponseProvider, IExcelExportService excelExportService) | ||||
|         public SurveyResponsesController(ISurveysResponse surveyResponseProvider) | ||||
|         { | ||||
|             this.surveyResponseProvider = surveyResponseProvider; | ||||
|             this.excelExportService = excelExportService; | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// GET request for retrieving survey responses. | ||||
| @ -59,9 +57,9 @@ namespace DamageAssesment.Api.Responses.Controllers | ||||
|         [Route("responses/{surveyid:int}/{locationid:int}/{employeeid:int}")] | ||||
|         [Route("responses/{surveyid:int}/{locationid:int}")] | ||||
|         [HttpGet] | ||||
|         public async Task<ActionResult> GetSurveyResponsesBySurveyAndLocationAsync(int surveyid, int locationid, int? employeeid) | ||||
|         public async Task<ActionResult> GetSurveyResponsesBySurveyAndLocationAsync(int surveyid, int locationid,int? employeeid) | ||||
|         { | ||||
|             var result = await this.surveyResponseProvider.GetSurveyResponsesBySurveyAndLocationAsync(surveyid, locationid, employeeid ?? 0); | ||||
|             var result = await this.surveyResponseProvider.GetSurveyResponsesBySurveyAndLocationAsync(surveyid, locationid,employeeid ?? 0); | ||||
|             if (result.IsSuccess) | ||||
|             { | ||||
|                 return Ok(result.SurveyResponses); | ||||
| @ -200,9 +198,7 @@ namespace DamageAssesment.Api.Responses.Controllers | ||||
|             else | ||||
|                 return BadRequest(result.ErrorMessage); | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// Get All active surveys . | ||||
|         /// </summary> | ||||
|  | ||||
|         [Route("responses/surveys/active")] | ||||
|         [Route("responses/surveys/active/{language:alpha}")] | ||||
|         [Route("responses/surveys/active/{employeeid:int}")] | ||||
| @ -217,39 +213,7 @@ namespace DamageAssesment.Api.Responses.Controllers | ||||
|             } | ||||
|             return NoContent(); | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// Export surveys based on role . | ||||
|         /// </summary> | ||||
|         [HttpGet] | ||||
|  | ||||
|         [Route("responses/surveys/export")] | ||||
|         public async Task<ActionResult> GetExcelSurveysAsync(string language,bool IsAdmin=false) | ||||
|         { | ||||
|             var result = await this.surveyResponseProvider.ExportSurveyResponsesAsync(language, IsAdmin); | ||||
|             if (result.IsSuccess) | ||||
|             { | ||||
|                 byte[] fileContents = excelExportService.ExportToExcel<object>(result.surveyResponses); | ||||
|                 return File(fileContents, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "data.xlsx"); | ||||
|                 //return Ok(result.Surveys); | ||||
|             } | ||||
|             return NoContent(); | ||||
|         } | ||||
|         //[Route("responses/surveys/active")] | ||||
|         //[Route("responses/surveys/active/{language:alpha}")] | ||||
|         //[HttpGet] | ||||
|         //public async Task<ActionResult> GetActiveSurveysAsync( string? language) | ||||
|         //{ | ||||
|         //    var result = await this.surveyResponseProvider.GetActiveSurveysAsync(null, language); | ||||
|         //    if (result.IsSuccess) | ||||
|         //    { | ||||
|         //        return Ok(result.Surveys); | ||||
|         //    } | ||||
|         //    return NoContent(); | ||||
|         //} | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Get all historical surveys . | ||||
|         /// </summary> | ||||
|         [Route("responses/surveys/historic")] | ||||
|         [Route("responses/surveys/historic/{language:alpha}")] | ||||
|         [Route("responses/surveys/historic/{employeeid:int}")] | ||||
|  | ||||
		Reference in New Issue
	
	Block a user