Skip to content

Commit

Permalink
Merge pull request #6 from Felix-CodingClimber/dev-felix
Browse files Browse the repository at this point in the history
Github repo cleanup. Added first tests.
  • Loading branch information
Felix-CodingClimber authored Jan 15, 2024
2 parents c7b390c + 6ccd34b commit b8bf986
Show file tree
Hide file tree
Showing 43 changed files with 1,165 additions and 172 deletions.
8 changes: 7 additions & 1 deletion DotNetElements.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetElements.CrudExample", "samples\DotNetElements.CrudExample\DotNetElements.CrudExample.csproj", "{5841B4C6-1339-412F-97F4-D17C6E3D3D24}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetElements.Core", "src\DotNetElements.Core\DotNetElements.Core.csproj", "{1CEE4FCD-1A35-4365-A6A1-6F05937B4E3A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetElements.Core", "src\DotNetElements.Core\DotNetElements.Core.csproj", "{1CEE4FCD-1A35-4365-A6A1-6F05937B4E3A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetElements.Core.Test", "test\DotNetElements.Core.Test\DotNetElements.Core.Test.csproj", "{9BA47821-EBE3-4290-877B-FE75340AE33E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -21,6 +23,10 @@ Global
{1CEE4FCD-1A35-4365-A6A1-6F05937B4E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CEE4FCD-1A35-4365-A6A1-6F05937B4E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CEE4FCD-1A35-4365-A6A1-6F05937B4E3A}.Release|Any CPU.Build.0 = Release|Any CPU
{9BA47821-EBE3-4290-877B-FE75340AE33E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BA47821-EBE3-4290-877B-FE75340AE33E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BA47821-EBE3-4290-877B-FE75340AE33E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BA47821-EBE3-4290-877B-FE75340AE33E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Felix-CodingClimber

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
225 changes: 225 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
<a name="readme-top"></a>

<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![Uptime Robot status](https://img.shields.io/uptimerobot/status/m796178913-32633fee88c8a4bfdc895a64?label=DOCs%20STATUS)](https://dotnet-elements.felixstrauss.dev/)

<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/Felix-CodingClimber/DotNetElements">
<img src="brand/Logo.png" alt="Logo" width="424" height="123">
</a>

<h3 align="center">DotNet Elements</h3>

<p align="center">
Opinionated framework to build .NET applications fast and easy while focusing more on the final product and less on writing low-level code.
<br />
<a href="https://dotnet-elements.felixstrauss.dev/"><strong>Explore the docs »</strong></a>
<br />
<br />
<!--
<a href="https://github.com/Felix-CodingClimber/DotNetElements">View Demo</a>
·
-->
<a href="https://github.com/Felix-CodingClimber/DotNetElements/issues">Report Bug</a>
·
<a href="https://github.com/Felix-CodingClimber/DotNetElements/issues">Request Feature</a>
</p>
</div>



<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<!--
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
-->
<li><a href="#license">License</a></li>
<!--
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
-->
</ol>
</details>



<!-- ABOUT THE PROJECT -->
## About The Project
<!--
[![Product Name Screen Shot][product-screenshot]](https://example.com)
-->
> [!CAUTION]
> Framework is work in progress and not considered production ready (while still used in some personal projects). Feel free to try it out and share your thoughts.
<p align="right">(<a href="#readme-top">back to top</a>)</p>



### Built With

[![NET][.NET]][.NET-url]

<p align="right">(<a href="#readme-top">back to top</a>)</p>



<!-- GETTING STARTED -->
<!--
## Getting Started
This is an example of how you may give instructions on setting up your project locally.
To get a local copy up and running follow these simple example steps.
### Prerequisites
This is an example of how to list things you need to use the software and how to install them.
* npm
```sh
npm install npm@latest -g
```
### Installation
1. Get a free API Key at [https://example.com](https://example.com)
2. Clone the repo
```sh
git clone https://github.com/github_username/repo_name.git
```
3. Install NPM packages
```sh
npm install
```
4. Enter your API in `config.js`
```js
const API_KEY = 'ENTER YOUR API';
```
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->


<!-- USAGE EXAMPLES -->
<!--## Usage
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
_For more examples, please refer to the [Documentation](https://example.com)_
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->


<!-- ROADMAP -->
<!--
## Roadmap
- [ ] Feature 1
- [ ] Feature 2
- [ ] Feature 3
- [ ] Nested Feature
See the [open issues](https://github.com/github_username/repo_name/issues) for a full list of proposed features (and known issues).
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->


<!-- CONTRIBUTING -->
<!--
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->


<!-- LICENSE -->
## License

Distributed under the MIT License. See `LICENSE.txt` for more information.

<p align="right">(<a href="#readme-top">back to top</a>)</p>



<!-- CONTACT -->
<!--
## Contact
Your Name - [@twitter_handle](https://twitter.com/twitter_handle) - email@email_client.com
Project Link: [https://github.com/github_username/repo_name](https://github.com/github_username/repo_name)
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->


<!-- ACKNOWLEDGMENTS -->
<!--
## Acknowledgments
* []()
* []()
* []()
<p align="right">(<a href="#readme-top">back to top</a>)</p>
-->


<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[.NET]: https://img.shields.io/badge/.NET-000000?style=for-the-badge&logo=dotnet&labelColor=512BD4
[.NET-url]: https://dotnet.microsoft.com/en-us/

<!--
[contributors-shield]: https://img.shields.io/github/contributors/github_username/repo_name.svg?style=for-the-badge
[contributors-url]: https://github.com/github_username/repo_name/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/github_username/repo_name.svg?style=for-the-badge
[forks-url]: https://github.com/github_username/repo_name/network/members
[stars-shield]: https://img.shields.io/github/stars/github_username/repo_name.svg?style=for-the-badge
[stars-url]: https://github.com/github_username/repo_name/stargazers
[issues-shield]: https://img.shields.io/github/issues/github_username/repo_name.svg?style=for-the-badge
[issues-url]: https://github.com/github_username/repo_name/issues
[license-shield]: https://img.shields.io/github/license/github_username/repo_name.svg?style=for-the-badge
[license-url]: https://github.com/github_username/repo_name/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/linkedin_username
[product-screenshot]: images/screenshot.png
-->
Binary file added brand/Logo_Modified/Logo_Small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions samples/DotNetElements.CrudExample/Components/Pages/Crud.razor
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ else
if (result.Canceled)
return;

Result<Tag> createdTag = await tagRepository.CreateAsync(editTagModel.MapToEntity());
CrudResult<Tag> createdTag = await tagRepository.CreateAsync(editTagModel.MapToEntity());

if (createdTag.IsFail)
{
snackbar.Add("Failed to create tag", Severity.Error);
snackbar.Add($"Failed to create tag.\n{createdTag.Message}", Severity.Error);
return;
}

Expand All @@ -238,11 +238,11 @@ else
if (result.Canceled)
return;

Result<Tag> updatedTag = await tagRepository.UpdateAsync<Tag, EditTagModel>(editTagModel.Id, editTagModel);
CrudResult<Tag> updatedTag = await tagRepository.UpdateAsync<Tag, EditTagModel>(editTagModel.Id, editTagModel);

if (updatedTag.IsFail)
{
snackbar.Add("Failed to update tag", Severity.Error);
snackbar.Add($"Failed to update tag.\n{updatedTag.Message}", Severity.Error);
return;
}

Expand All @@ -259,11 +259,11 @@ else
if (confirmResult.IsFail)
return;

Result deleteResult = await tagRepository.DeleteAsync(tag.Id);
CrudResult deleteResult = await tagRepository.DeleteAsync(tag);

if(deleteResult.IsFail)
{
snackbar.Add("Failed to delete tag", Severity.Error);
snackbar.Add($"Failed to delete tag.\n{deleteResult.Message}", Severity.Error);
return;
}

Expand All @@ -281,11 +281,11 @@ else
return;
}

Result<AuditedModelDetails> details = await tagRepository.GetAuditedModelDetailsByIdAsync<Tag>(context.Value.Id);
CrudResult<AuditedModelDetails> details = await tagRepository.GetAuditedModelDetailsByIdAsync<Tag>(context.Value.Id);

if(details.IsFail)
{
snackbar.Add("Failed to fetch tag details", Severity.Error);
snackbar.Add($"Failed to fetch tag details.\n{details.Message}", Severity.Error);
return;
}

Expand Down Expand Up @@ -313,11 +313,11 @@ else
if (result.Canceled)
return;

Result<BlogPost> createdBlogPost = await blogPostRepository.CreateAsync(editBlogPostModel.MapToEntity());
CrudResult<BlogPost> createdBlogPost = await blogPostRepository.CreateAsync(editBlogPostModel.MapToEntity());

if (createdBlogPost.IsFail)
{
snackbar.Add("Failed to create blog post", Severity.Error);
snackbar.Add($"Failed to create blog post.\n{createdBlogPost.Message}", Severity.Error);
return;
}

Expand Down Expand Up @@ -346,11 +346,11 @@ else
if (result.Canceled)
return;

Result<BlogPost> updatedBlogPost = await blogPostRepository.UpdateAsync<BlogPost, EditBlogPostModel>(editBlogPostModel.Id, editBlogPostModel);
CrudResult<BlogPost> updatedBlogPost = await blogPostRepository.UpdateAsync<BlogPost, EditBlogPostModel>(editBlogPostModel.Id, editBlogPostModel);

if (updatedBlogPost.IsFail)
{
snackbar.Add("Failed to update blog post", Severity.Error);
snackbar.Add($"Failed to update blog post.\n{updatedBlogPost.Message}", Severity.Error);
return;
}

Expand All @@ -366,11 +366,11 @@ else
if (confirmResult.IsFail)
return;

Result deleteResult = await blogPostRepository.DeleteAsync(blogPost.Id);
CrudResult deleteResult = await blogPostRepository.DeleteAsync(blogPost);

if(deleteResult.IsFail)
{
snackbar.Add("Failed to delete blog post", Severity.Error);
snackbar.Add($"Failed to delete blog post.\n{deleteResult.Message}", Severity.Error);
return;
}

Expand All @@ -387,11 +387,11 @@ else
return;
}

Result<AuditedModelDetails> details = await blogPostRepository.GetAuditedModelDetailsByIdAsync<BlogPost>(context.Value.Id);
CrudResult<AuditedModelDetails> details = await blogPostRepository.GetAuditedModelDetailsByIdAsync<BlogPost>(context.Value.Id);

if(details.IsFail)
{
snackbar.Add("Failed to fetch blog post details", Severity.Error);
snackbar.Add($"Failed to fetch blog post details.\n{details.Message}", Severity.Error);
return;
}

Expand Down
Loading

0 comments on commit b8bf986

Please sign in to comment.