コード例 #1
0
        public async Task <UseCaseResponse <IEnumerable <Asset> > > Execute()
        {
            var response = new UseCaseResponse <IEnumerable <Asset> >();

            try
            {
                var assets = await assetRepository.List();

                return(response.SetResult(assets));
            }
            catch (Exception e)
            {
                logger.LogError(e.Message, e);
                return(response.SetInternalServerError("Unexpected error: " + e.Message));
            }
        }
コード例 #2
0
        public async Task <UseCaseResponse <bool> > Execute(Guid id)
        {
            var response = new UseCaseResponse <bool>();

            try
            {
                await assetRepository.Delete(id);

                return(response.SetResult(true));
            }
            catch (Exception e)
            {
                logger.LogError(e.Message, e);
                return(response.SetInternalServerError("Unexpected error: " + e.Message));
            }
        }