mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-18 14:47:43 +00:00
implement mvc with call notification api from electron
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
@@ -12,5 +14,15 @@ namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult SayHello()
|
||||
{
|
||||
App.CreateNotification(new NotificationOptions {
|
||||
Title = "Hallo Robert",
|
||||
Body = "Nachricht von ASP.NET Core App"
|
||||
});
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace ElectronNET.WebApp
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
var electronApp = new App(800, 600, true);
|
||||
App.OpenWindow(800, 600, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
<title>Home</title>
|
||||
</head>
|
||||
<body>
|
||||
Hello from MVC!
|
||||
<h3>Hello from ASP.NET Core MVC!</h3>
|
||||
|
||||
<br /><br />
|
||||
<input type="button" value="Call Notification" onclick="location.href='@Url.Action("SayHello", "Home")'" />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user