45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Microsoft.AspNetCore.Mvc.Rendering;
|
|
using FakturyWeb.Data;
|
|
using RazorPagesMovie.Models;
|
|
|
|
namespace FakturyWeb.Pages.Zakaznik
|
|
{
|
|
public class CreateModel : PageModel
|
|
{
|
|
private readonly FakturyWeb.Data.FakturyWebContext _context;
|
|
|
|
public CreateModel(FakturyWeb.Data.FakturyWebContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public IActionResult OnGet()
|
|
{
|
|
return Page();
|
|
}
|
|
|
|
[BindProperty]
|
|
public ZAKAZNIK ZAKAZNIK { get; set; }
|
|
|
|
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
|
|
public async Task<IActionResult> OnPostAsync()
|
|
{
|
|
if (!ModelState.IsValid)
|
|
{
|
|
return Page();
|
|
}
|
|
|
|
_context.ZAKAZNIK.Add(ZAKAZNIK);
|
|
await _context.SaveChangesAsync();
|
|
|
|
return RedirectToPage("./Index");
|
|
}
|
|
}
|
|
}
|