Exemplo n.º 1
0
        public async Task <IActionResult> CreateInitiativeYear(InitiativeYearForCreateDto initiativeYearForCreateDto)
        {
            var initiativeYear = await _initiativeService.GetInitiativeYearByYear(initiativeYearForCreateDto.Year);

            if (initiativeYear != null)
            {
                return(BadRequest("Initiative year already exists"));
            }
            var result = await _initiativeService.CreateInitiativeYear(initiativeYearForCreateDto);

            if (result == true)
            {
                return(Ok());
            }
            return(BadRequest("Initiative year creation failed"));
        }