Exemple #1
0
        public async Task <IActionResult> Edit([FromRoute] string initiaitveId, [FromBody] InitiativeDto initiativeDto)
        {
            if (initiativeDto == null)
            {
                logger.LogError("Initiative Dto Object is empty");
                return(new BadRequestObjectResult(new { error = "Initiative Dto Object cannot be null" }));
            }

            if (String.IsNullOrEmpty(initiaitveId))
            {
                logger.LogError("Parameter is empty");
                return(new BadRequestObjectResult(new { error = "Parameters cannot be empty" }));
            }

            try
            {
                var result = await initiativeService.EditInitiative(new Guid(initiaitveId), initiativeDto);

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