public IActionResult AddInf(AddInformation addInformation) { if (ModelState.IsValid) { db.AddInf(addInformation); return(RedirectToAction("Index", "Home")); } return(RedirectToAction("Index", "Home")); }
public void AddInf(AddInformation addInformation) { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string sql = "INSERT INTO Informations VALUES (" + addInformation.Id + ", '" + addInformation.Hobby + "', '" + addInformation.Text + "', '" + addInformation.Img + "')"; SqlCommand command = new SqlCommand(sql, connection); command.ExecuteNonQuery(); } }
public override IResult Add(AddInformation info) { throw new NotImplementedException(); }