Skip to content

Commit 8044fb7

Browse files
Develop (#122)
* 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)
1 parent 63d5f1f commit 8044fb7

File tree

5 files changed

+8
-95
lines changed

5 files changed

+8
-95
lines changed

src/CmsEngine.Ui/Controllers/HomeController.cs

+2-42
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@ namespace CmsEngine.Ui.Controllers;
22

33
public class HomeController : BaseController
44
{
5-
private readonly ICmsEngineEmailSender _emailSender;
65
private readonly IPageService _pageService;
76
private readonly IXmlService _xmlService;
8-
private readonly IEmailService _emailService;
97

10-
public HomeController(ILoggerFactory loggerFactory, ICmsEngineEmailSender emailSender, IPageService pageService, IXmlService xmlService,
11-
ICategoryService categoryService, ITagService tagService, IService service, IPostService postService,
12-
IEmailService emailService)
8+
public HomeController(ILoggerFactory loggerFactory, IPageService pageService, IXmlService xmlService,
9+
ICategoryService categoryService, ITagService tagService, IService service, IPostService postService)
1310
: base(loggerFactory, service, categoryService, pageService, postService, tagService)
1411
{
15-
_emailSender = emailSender;
1612
_pageService = pageService;
1713
_xmlService = xmlService;
18-
_emailService = emailService;
1914
}
2015

2116
public IActionResult Index()
@@ -43,41 +38,6 @@ public IActionResult Archive()
4338
return View(Instance);
4439
}
4540

46-
public IActionResult Contact()
47-
{
48-
Instance.PageTitle = $"Contact - {Instance.Name}";
49-
return View(Instance);
50-
}
51-
52-
[HttpPost]
53-
public async Task<IActionResult> ContactAsync(ContactForm contactForm)
54-
{
55-
if (!ModelState.IsValid)
56-
{
57-
TempData[MessageConstants.WarningMessage] = "Please double check the information in the form and try again.";
58-
return View(Instance);
59-
}
60-
61-
contactForm.To = Instance.ContactDetails?.Email;
62-
63-
try
64-
{
65-
if ((await _emailService.Save(contactForm)).IsError)
66-
{
67-
throw new Exception("Error when saving e-mail");
68-
}
69-
70-
await _emailSender.SendEmailAsync(contactForm);
71-
TempData[MessageConstants.SuccessMessage] = "Your message was sent. I will answer as soon as I can.";
72-
}
73-
catch (EmailException)
74-
{
75-
TempData[MessageConstants.DangerMessage] = "We could not send the messsage. Please try other communication channels.";
76-
}
77-
78-
return RedirectToAction(nameof(HomeController.Contact));
79-
}
80-
8141
public async Task<IActionResult> SitemapAsync()
8242
{
8343
var sitemap = await _xmlService.GenerateSitemap();

src/CmsEngine.Ui/Program.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@
176176
pattern: "archive",
177177
defaults: new { controller = "Home", action = "Archive" });
178178

179+
// Deprecated route, redirecting to Index
179180
app.MapControllerRoute(
180181
name: "contact",
181182
pattern: "contact",
182-
defaults: new { controller = "Home", action = "Contact" });
183+
defaults: new { controller = "Home", action = "Index" });
183184

184185
app.MapControllerRoute(
185186
name: "error",

src/CmsEngine.Ui/Views/Home/Contact.cshtml

-51
This file was deleted.

src/CmsEngine.Ui/Views/Shared/_Layout.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<a asp-controller="Home" asp-action="Archive" class="nav-link @Html.IsSelected(controllers: "Home", actions: "Archive")">Archive</a>
8282
</li>
8383
<li class="nav-item">
84-
<a asp-controller="Home" asp-action="Contact" class="nav-link @Html.IsSelected(controllers: "Home", actions: "Contact")">Contact</a>
84+
<a href="/subscribe" class="nav-link @Html.IsSelected(slugs: "subscribe")">Subscribe</a>
8585
</li>
8686
<li class="nav-item">
8787
<a href="/subscribe" class="nav-link @Html.IsSelected(slugs: "subscribe")">Subscribe</a>

src/CmsEngine.Ui/appsettings.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"ConnectionStrings": {
3+
"DefaultConnection": ""
4+
},
25
"Logging": {
36
"Logging": {
47
"LogLevel": {

0 commit comments

Comments
 (0)