コード例 #1
0
        public async Task <DeleteTimeEntryResponse> DeleteTimeSheetEntry(Guid id)
        {
            var timeSheetEntry = Repository.GetById(id);

            if (timeSheetEntry == null)
            {
                // This can be a custom exception so that NotFound (404) could be thrown
                throw new Exception($"User:{id} not found");
            }
            ;
            timeSheetEntry.Delete();
            Repository.Delete(timeSheetEntry);
            await UnitOfWork.Commit();

            return(new DeleteTimeEntryResponse {
                Success = true
            });
        }
コード例 #2
0
        public Task <TimeEntryData> GetTimeSheetEntry(Guid id)
        {
            var timeEntry = Repository.GetById(id);

            return(timeEntry == null ? null:Task.FromResult(MapTimeEntryDomainFields(timeEntry)));
        }