UsersController returns! Design updates

This commit is contained in:
Dimitar Byalkov
2022-04-08 22:09:31 +03:00
parent c9777042c0
commit 8935dbdc99
10 changed files with 361 additions and 98 deletions

View File

@@ -20,14 +20,14 @@ namespace WebApp.Controllers
{
_context = context;
}
[Authorize]
public async Task<IActionResult> Index()
{
return View(await _context.Cars.ToListAsync());
}
// GET: Cars/Details/5
[Authorize]
public async Task<IActionResult> Details(int? id)
{
if (id == null)
@@ -58,7 +58,7 @@ namespace WebApp.Controllers
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
[Authorize(Roles = "Admin")]
public async Task<IActionResult> Create([Bind("Id, Brand, Model, Year, CountPassengerSeats, Description, PriceForDay")] Car car)
{
if (ModelState.IsValid)
@@ -147,6 +147,7 @@ namespace WebApp.Controllers
// POST: Cars/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
[Authorize(Roles = "Admin")]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var car = await _context.Cars.FindAsync(id);