title: LINQ ASP .net mvc actionresult CREATE
body: <p>This is my code of the ActionResult Create method:</p>
  
  <pre><code>public ActionResult Create([Bind(Include = "FileStatusID, Name, MinValue, MaxValue")] fileStatusModel FILeStatusModel, TBL_FileStatus tBL_FileStatus) //include tem os valores que vamos inserir na view
  {
      var userID = ((SessionModel)Session["SessionModel"]).UserID; // get current user id
      using (var query = new Core_DBEntities)
      {
          var query1 = ??????????????
      }
      if (ModelState.IsValid)
      {
          TBL_FileStatus item = new TBL_FileStatus()
          {
              Name = FILeStatusModel.Name,
              MinValue = FILeStatusModel.MinValue,
              MaxValue = FILeStatusModel.MaxValue,
              Ative = true,
              CreateDate = DateTime.Now,
              CreateBy = userID
          };
  
          db.TBL_FileStatus.Add(item);
          db.SaveChanges();
          return RedirectToAction("Index");
      }
      return View();
  }
  </code></pre>
  
  <p>And this is my SQL query: </p>
  
  <pre><code>DECLARE @p_valuemin INT
  DECLARE @p_valuemax INT
  
  SET @p_valuemin = 9   
  SET @p_valuemax = 183
  
  IF @p_valuemin &gt;= @p_valuemax
      RAISERROR('@p_valuemin deve ser menor que o @p_valuemax', 16, 1)
  
  SELECT *
  FROM [TBL_FileStatus]
  WHERE Ative = 1 AND ((@p_valuemin BETWEEN MinValue AND MaxValue) AND MaxValue &lt;&gt; @p_valuemin)
  OR ((@p_valuemax BETWEEN MinValue AND MaxValue) AND MinValue &lt;&gt; @p_valuemax)
  UNION
  SELECT *
  FROM [TBL_FileStatus]
  WHERE Ative = 1 AND ((MinValue BETWEEN @p_valuemin AND @p_valuemax) AND MinValue &lt;&gt; @p_valuemax)
  OR ((MaxValue BETWEEN @p_valuemin AND @p_valuemax) AND MaxValue &lt;&gt; @p_valuemin)
  
  those 2 values will represent the textbox of create
  SET @p_valuemin = 9   
  SET @p_valuemax = 183
  </code></pre>
  
  <p>My question is:</p>
  
  <p>I want to join this SQL query with the ActionResult Create, to make a condition before clicking on the create button. </p>
  
  <p>How can i achieve this?</p>