public int addTipe(RefTipe item) { if (cnn.QueryFirstOrDefault <RefTipe>("SELECT * FROM `ref. tipe` WHERE Tipe = '" + item.Tipe + "';") == null) { string sql = "INSERT INTO `ref. tipe`(Tipe) VALUES ('" + item.Tipe + "')"; return(cnn.Execute(sql)); } return(0); }
public IActionResult Tipe([FromBody] RefTipe item) { if (repo.addTipe(item) > 0) { return(Ok(okPost)); } else { return(NotFound(post)); } }