コード例 #1
0
        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."));
            }
        }
コード例 #2
0
        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."));
            }
        }
コード例 #3
0
        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."));
            }
        }