public async Task <IActionResult> GetAll() { var businessId = _contextService.GetBusinessId(HttpContext); try { var response = await _service.GetAll(businessId); return(Ok(response)); } catch (Exception x) { _log.LogError(ExceptionLogger.ExceptionDetails(x)); return(StatusCode(500, "Internal Server Error.")); } }
public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] QuestionModel model) { try { var response = await _service.Update(model); if (!response.IsSuccessful) { return(BadRequest(response)); } return(Ok(response)); } catch (Exception x) { _log.LogError(ExceptionLogger.ExceptionDetails(x)); return(StatusCode(500, "Internal Server Error.")); } }
public async Task <IActionResult> Delete(Guid id) { try { var response = await _service.Delete(id); if (!response.IsSuccessful) { return(BadRequest(response)); } return(Ok(response)); } catch (Exception x) { _log.LogError(ExceptionLogger.ExceptionDetails(x)); return(StatusCode(500, "Internal Server Error.")); } }