コード例 #1
0
        public async Task <IActionResult> GetById(string initiaitveId)
        {
            if (String.IsNullOrEmpty(initiaitveId))
            {
                logger.LogError("Parameter is empty");
                return(new BadRequestObjectResult(new { error = "Parameters cannot be empty" }));
            }

            try
            {
                var result = await initiativeService.GetInitiativeById(new Guid(initiaitveId));

                return(Ok(result));
            }
            catch (Exception ex)
            {
                logger.LogError(ex, ex.Message);
                return(BadRequest($"Something went wrong!, {ex.Message}"));
            }
        }