コード例 #1
0
    public IActionResult Upsert([FromForm] Student student, int id)
    {
        // Request.Form.Log();
        // student.Log();

        var s = classroom.get(id);

        if (s != null)
        {
            classroom.delete(id);
        }

        // make sure that the id is the same as
        student.StudentId = id;
        classroom.add(student);
        return(RedirectToAction("ReadAll"));
    }
コード例 #2
0
 public IActionResult Create([FromBody] Student s)
 {
     classroom.add(s);
     return(Ok());
 }