Ejemplo n.º 1
0
        public async Task <Result> DeleteWorkAsync(Guid id)
        {
            var existWork = await _workRepository.ExistAsync(id);

            if (!existWork)
            {
                return(new Result(Status.NotFund, $"Work with {nameof(id)} does not exist"));
            }

            var work = await _workRepository.GetByIdAsync(id);

            await _workRepository.DeleteAsync(work);

            var result = await _mockyService.SendNotificationAsync("Lançamento de horas", "Um lançamento de horas foi removido");

            if (!result.Success || !result.Data)
            {
                return(new Result(Status.Error, result.ErrorMessages));
            }
            return(new Result());
        }