Dodawanie/Usuwanie

Dodawanie/Usuwanie (nie chce tu przeklinać)
This commit is contained in:
Witkopawel
2025-04-25 05:19:36 +02:00
parent 981236f6aa
commit 9151fbb6ab
6 changed files with 163 additions and 24 deletions

View File

@@ -1,32 +1,32 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using WebApp.Data;
using WebApp.Models;
namespace WebApp.Controllers
public class HomeController : Controller
{
public class HomeController : Controller
private readonly ILogger<HomeController> _logger;
private readonly ApplicationDbContext _context;
public HomeController(ILogger<HomeController> logger, ApplicationDbContext context)
{
private readonly ILogger<HomeController> _logger;
_logger = logger;
_context = context;
}
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
var events = _context.Events.ToList(); // pobieranie danych z bazy
return View(events); // przekazanie do widoku
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}