public async Task UpdateCharityStatus(Guid id, CharityStatusRequestDto charityStatusRequestDto)
        {
            var charityModel = Repository.GetWhereAsQueryable(c => c.Id.Equals(id)).First();

            charityModel.IsActive = charityStatusRequestDto.Active;

            this.Repository.Udate(charityModel);
            await this.Repository.SaveAsync();
        }
예제 #2
0
        public async Task <ActionResult> UpdateCharityStatus(Guid id, CharityStatusRequestDto charityStatusRequestDto)
        {
            // Check if the donor already exists
            var charity = await CharitableEntityApplication.GetCharity((c) => c.Id.Equals(id));

            if (charity == null)
            {
                ErrorMessage error = new ErrorMessage((int)HttpStatusCode.BadRequest, $"A entidade beneficente, {id}, não foi encontrada.");
                return(NotFound(error));
            }

            await CharitableEntityApplication.UpdateCharityStatus(id, charityStatusRequestDto);

            return(Ok());
        }