You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
718 B
31 lines
718 B
using Microsoft.AspNetCore.Mvc; |
|
using SolverWebApp.Model; |
|
|
|
namespace SolverWebApp.Controllers; |
|
|
|
[ApiController] |
|
public class SolutionController : Controller |
|
{ |
|
// Retrieves all solutions from the database |
|
[Route("solution")] |
|
public ActionResult Index() |
|
{ |
|
using (var db = new SolutionContext()) |
|
{ |
|
var solutions = db.Solutions.ToList(); |
|
return Json(solutions); |
|
} |
|
} |
|
|
|
[HttpPost] |
|
[Route("solution")] |
|
public ActionResult StoreSolution(Solution solution) |
|
{ |
|
using (var db = new SolutionContext()) |
|
{ |
|
var ee = db.Solutions.Add(solution); |
|
db.SaveChanges(); |
|
} |
|
return NoContent(); |
|
} |
|
}
|
|
|