title: Call void function inside of controller
body: <p>I have following controller:</p>
  
  <pre><code>public ActionResult delete(int id)
      {
          //call function
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>here I want to call following function from my model:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using MySql.Data.MySqlClient;
  
  namespace project1.Models.Admin
  {
  public class delete
  {
      public void delete(int id)
          {
          //xxx
          const string ConnStr = "...";
  
          MySqlConnection connection = new MySqlConnection(ConnStr);
          connection.Open(); 
          MySqlCommand sqlcmd2;
          sqlcmd2 = connection.CreateCommand();
          sqlcmd2.CommandText = "UPDATE `user` SET Aktive = 0 WHERE Nr = @id;";
  
          sqlcmd2.Parameters.Add("@id", MySqlDbType.Int32).Value = id;
  
          sqlcmd2.ExecuteNonQuery();
  
          connection.Close();
          //xxx
      }
  
  }
  }
  </code></pre>
  
  <p>I get the error that "void" isn't allowed in this context. Is there any other way to call my function here or should I put the whole connection (inside "xxx") into my controller? </p>