Skip to content

Commit

Permalink
Develop (#122)
Browse files Browse the repository at this point in the history
* Features/upgrate to dotnet 6 (#108)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Features/fix email bugs (#110)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Features/fix email bugs (#112)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Feature/fix email send issues (#114)

* Removed development files

* Updated .gitignore

* Added MailKit library

* Implemented e-mail sender with MailKit

* Feature/minor changes (#116)

* Updated nuget packages

* Improved HtmlHelperExtensions logic and added possibility to use with slugs

* Added "About me" menu item

* Feature/code improvements (#117)

* Add possibility to use global.json

* Add global.json file with targeting SDK 6.0.403

* Removed warnings

* Add exclusion of generated code

* Exclude Identity pages from null check

* Update packages; Add ardalis.GuardClauses

* Remove warnings

* Remove null warnings; Minor code improvements

* Fixed post not being saved

* Fixed post not being saved

* Add filter to prevent articles to appear before publishing time

* Add filter to prevent articles to appear before publishing time

* Add about me and subscribe; Reorder menu

* Add Author partial view

* Change DateTime format

* Add SASS package

* Reduce padding; Add max-height of 100%

* Minor improvements (#118)

* Develop (#113)

* Features/upgrate to dotnet 6 (#108)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Features/fix email bugs (#110)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Features/fix email bugs (#112)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Bugfix for e-mail sending (#115)

* Features/upgrate to dotnet 6 (#108)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Features/fix email bugs (#110)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Features/fix email bugs (#112)

* Moved files to src; Adapted C# code to a more modern approach; Minor refactoring everywhere

* Removed old project folders/files

* Removed temporary old solution

* Refactored code; Set some members to nullable

* Changed usage on TryUpdateModelAsync

* Fixed e-mail issues

* Feature/fix email send issues (#114)

* Removed development files

* Updated .gitignore

* Added MailKit library

* Implemented e-mail sender with MailKit

* Feature/remove contact form (#120)

* Add empty connection strings

* Removed Contact form and references

* Redirected contact route to index

* Feature/fix merge issues (#121)
  • Loading branch information
davidsonsousa authored Jun 19, 2023
1 parent 63d5f1f commit 8044fb7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 95 deletions.
44 changes: 2 additions & 42 deletions src/CmsEngine.Ui/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ namespace CmsEngine.Ui.Controllers;

public class HomeController : BaseController
{
private readonly ICmsEngineEmailSender _emailSender;
private readonly IPageService _pageService;
private readonly IXmlService _xmlService;
private readonly IEmailService _emailService;

public HomeController(ILoggerFactory loggerFactory, ICmsEngineEmailSender emailSender, IPageService pageService, IXmlService xmlService,
ICategoryService categoryService, ITagService tagService, IService service, IPostService postService,
IEmailService emailService)
public HomeController(ILoggerFactory loggerFactory, IPageService pageService, IXmlService xmlService,
ICategoryService categoryService, ITagService tagService, IService service, IPostService postService)
: base(loggerFactory, service, categoryService, pageService, postService, tagService)
{
_emailSender = emailSender;
_pageService = pageService;
_xmlService = xmlService;
_emailService = emailService;
}

public IActionResult Index()
Expand Down Expand Up @@ -43,41 +38,6 @@ public IActionResult Archive()
return View(Instance);
}

public IActionResult Contact()
{
Instance.PageTitle = $"Contact - {Instance.Name}";
return View(Instance);
}

[HttpPost]
public async Task<IActionResult> ContactAsync(ContactForm contactForm)
{
if (!ModelState.IsValid)
{
TempData[MessageConstants.WarningMessage] = "Please double check the information in the form and try again.";
return View(Instance);
}

contactForm.To = Instance.ContactDetails?.Email;

try
{
if ((await _emailService.Save(contactForm)).IsError)
{
throw new Exception("Error when saving e-mail");
}

await _emailSender.SendEmailAsync(contactForm);
TempData[MessageConstants.SuccessMessage] = "Your message was sent. I will answer as soon as I can.";
}
catch (EmailException)
{
TempData[MessageConstants.DangerMessage] = "We could not send the messsage. Please try other communication channels.";
}

return RedirectToAction(nameof(HomeController.Contact));
}

public async Task<IActionResult> SitemapAsync()
{
var sitemap = await _xmlService.GenerateSitemap();
Expand Down
3 changes: 2 additions & 1 deletion src/CmsEngine.Ui/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@
pattern: "archive",
defaults: new { controller = "Home", action = "Archive" });

// Deprecated route, redirecting to Index
app.MapControllerRoute(
name: "contact",
pattern: "contact",
defaults: new { controller = "Home", action = "Contact" });
defaults: new { controller = "Home", action = "Index" });

app.MapControllerRoute(
name: "error",
Expand Down
51 changes: 0 additions & 51 deletions src/CmsEngine.Ui/Views/Home/Contact.cshtml

This file was deleted.

2 changes: 1 addition & 1 deletion src/CmsEngine.Ui/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<a asp-controller="Home" asp-action="Archive" class="nav-link @Html.IsSelected(controllers: "Home", actions: "Archive")">Archive</a>
</li>
<li class="nav-item">
<a asp-controller="Home" asp-action="Contact" class="nav-link @Html.IsSelected(controllers: "Home", actions: "Contact")">Contact</a>
<a href="/subscribe" class="nav-link @Html.IsSelected(slugs: "subscribe")">Subscribe</a>
</li>
<li class="nav-item">
<a href="/subscribe" class="nav-link @Html.IsSelected(slugs: "subscribe")">Subscribe</a>
Expand Down
3 changes: 3 additions & 0 deletions src/CmsEngine.Ui/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"ConnectionStrings": {
"DefaultConnection": ""
},
"Logging": {
"Logging": {
"LogLevel": {
Expand Down

0 comments on commit 8044fb7

Please sign in to comment.