commiting some changes

This commit is contained in:
ani_konarcheva@abv.bg
2022-04-08 14:05:16 +03:00
parent e1f462fb1d
commit 547c6e8774
10 changed files with 56 additions and 37 deletions

View File

@@ -54,11 +54,11 @@ namespace WebApp.Controllers
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Id,StartDate,EndDate")] Rents rents)
public async Task<IActionResult> Create([Bind("Id,CarId,StartDate,EndDate,UserId")] Rents rents)
{
if (ModelState.IsValid)
{
var car = _context.Cars.FirstOrDefault(car => car.Id == 1);
var car = _context.Cars.FirstOrDefault(car => car.Id == rents.CarId);
rents.Car = car;
_context.Add(rents);
await _context.SaveChangesAsync();
@@ -88,7 +88,7 @@ namespace WebApp.Controllers
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,StartDate,EndDate")] Rents rents)
public async Task<IActionResult> Edit(int id, [Bind("Id,CarId,StartDate,EndDate,UserId")] Rents rents)
{
if (id != rents.Id)
{