46 lines
1.1 KiB
C#
46 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 Catalog26.Data;
|
|
using PricingCatalog.Models;
|
|
|
|
namespace Catalog26.Pages.TDSynnex;
|
|
|
|
public class CreateModel : PageModel
|
|
{
|
|
private readonly Catalog26.Data.Catalog26Context _context;
|
|
|
|
public CreateModel(Catalog26.Data.Catalog26Context context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public IActionResult OnGet()
|
|
{
|
|
return Page();
|
|
}
|
|
|
|
[BindProperty]
|
|
public TDSPriceAvailability TDSPriceAvailability { get; set; } = default!;
|
|
|
|
// For more information, see https://aka.ms/RazorPagesCRUD.
|
|
public async Task<IActionResult> OnPostAsync()
|
|
{
|
|
if (!ModelState.IsValid)
|
|
{
|
|
return Page();
|
|
}
|
|
|
|
// var emptyItem = new TDSPriceAvailability();
|
|
|
|
_context.TDSCatalogItems.Add(TDSPriceAvailability);
|
|
await _context.SaveChangesAsync();
|
|
|
|
return RedirectToPage("./Index");
|
|
}
|
|
}
|