Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file added .vs/ASP.NET.slnx/v18/.wsuo
Binary file not shown.
69 changes: 69 additions & 0 deletions .vs/ASP.NET.slnx/v18/DocumentLayout.backup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\Work_directory\\Git_repository\\ASP.NET\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 4\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Lessons\\Module 4\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 2. Publishing\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Lessons\\Module 2. Publishing\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 1\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Lessons\\Module 1\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "README.md",
"DocumentMoniker": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 4\\README.md",
"RelativeDocumentMoniker": "Lessons\\Module 4\\README.md",
"ToolTip": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 4\\README.md",
"RelativeToolTip": "Lessons\\Module 4\\README.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-03-20T14:12:36.011Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "README.md",
"DocumentMoniker": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 2. Publishing\\README.md",
"RelativeDocumentMoniker": "Lessons\\Module 2. Publishing\\README.md",
"ToolTip": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 2. Publishing\\README.md",
"RelativeToolTip": "Lessons\\Module 2. Publishing\\README.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-03-20T14:12:29.053Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "README.md",
"DocumentMoniker": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 1\\README.md",
"RelativeDocumentMoniker": "Lessons\\Module 1\\README.md",
"ToolTip": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 1\\README.md",
"RelativeToolTip": "Lessons\\Module 1\\README.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-03-20T14:12:22.877Z"
}
]
}
]
}
]
}
69 changes: 69 additions & 0 deletions .vs/ASP.NET.slnx/v18/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"Version": 1,
"WorkspaceRootPath": "D:\\Work_directory\\Git_repository\\ASP.NET\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 4\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Lessons\\Module 4\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 2. Publishing\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Lessons\\Module 2. Publishing\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 1\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Lessons\\Module 1\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "README.md",
"DocumentMoniker": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 4\\README.md",
"RelativeDocumentMoniker": "Lessons\\Module 4\\README.md",
"ToolTip": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 4\\README.md",
"RelativeToolTip": "Lessons\\Module 4\\README.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-03-20T14:12:36.011Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "README.md",
"DocumentMoniker": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 2. Publishing\\README.md",
"RelativeDocumentMoniker": "Lessons\\Module 2. Publishing\\README.md",
"ToolTip": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 2. Publishing\\README.md",
"RelativeToolTip": "Lessons\\Module 2. Publishing\\README.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-03-20T14:12:29.053Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "README.md",
"DocumentMoniker": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 1\\README.md",
"RelativeDocumentMoniker": "Lessons\\Module 1\\README.md",
"ToolTip": "D:\\Work_directory\\Git_repository\\ASP.NET\\Lessons\\Module 1\\README.md",
"RelativeToolTip": "Lessons\\Module 1\\README.md",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2026-03-20T14:12:22.877Z"
}
]
}
]
}
]
}
Binary file added .vs/ASP.NET/v18/workspaceFileList.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
13 changes: 13 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ExpandedNodes": [
"",
"\\Homeworks",
"\\Homeworks\\Base",
"\\Homeworks\\Base\\src",
"\\Homeworks\\Base\\src\\PromoCodeFactory.Core",
"\\Homeworks\\Base\\src\\PromoCodeFactory.DataAccess",
"\\Homeworks\\Base\\src\\PromoCodeFactory.WebHost"
],
"SelectedNode": "\\Homeworks\\Base\\src\\PromoCodeFactory.WebHost",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ public interface IRepository<T> where T: BaseEntity
{
Task<IEnumerable<T>> GetAllAsync();

Task<T> GetByIdAsync(Guid id);
Task<T?> GetByIdAsync(Guid id);

Task<T> CreateAsync(T entity);

Task<bool> UpdateAsync(T entity);

Task<bool> DeleteAsync(Guid id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,36 @@ public Task<IEnumerable<T>> GetAllAsync()
return Task.FromResult(Data);
}

public Task<T> GetByIdAsync(Guid id)
public Task<T?> GetByIdAsync(Guid id)
{
return Task.FromResult(Data.FirstOrDefault(x => x.Id == id));
}

public Task<T> CreateAsync(T entity)
{
if (entity.Id == Guid.Empty)
entity.Id = Guid.NewGuid();

Data = Data.Append(entity);
return Task.FromResult(entity);
}

public Task<bool> UpdateAsync(T entity)
{
var existingEntity = Data.FirstOrDefault(x => x.Id == entity.Id);
if (existingEntity == null)
return Task.FromResult(false);
Data = Data.Select(x => x.Id == entity.Id ? entity : x);
return Task.FromResult(true);
}

public Task<bool> DeleteAsync(Guid id)
{
var existingEntity = Data.FirstOrDefault(x => x.Id == id);
if (existingEntity is null)
return Task.FromResult(false);
Data = Data.Where(x => x.Id != id);
return Task.FromResult(true);
}
}
}
Loading