コード例 #1
0
 public IActionResult Post([FromBody] User user)
 {
     if (user == null)
     {
         return(BadRequest());
     }
     db.usr.Add(user);
     db.SaveChanges();
     return(Ok(user));
 }
コード例 #2
0
 public UserController(DbTables context)
 {
     this.db = context;
     if (!db.usr.Any())
     {
         db.usr.Add(new User {
             login = "******", pass_hash = "1hher4"
         });
         db.SaveChanges();
     }
 }