JPHD-2021-backend/Pages/Migrate.cshtml.cs

29 lines
722 B
C#

using _2021_backend.Data;
using _2021_backend.Models;
using _2021_backend.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using NPOI.HPSF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace _2021_backend.Pages
{
public class MigrateModel : PageModel
{
private readonly BackendContext _context;
public MigrateModel(BackendContext context)
{
_context = context;
}
public async Task<IActionResult> OnPost(string value)
{
_context.Database.Migrate();
return RedirectToPage("./Index");
}
}
}