title: Enter new data in db (EF)
body: <p>I have method in controller</p>
  
  <p>It receive  data from post request and write to table</p>
  
  <p>Here is code</p>
  
  <pre><code> [ResponseType(typeof(TimeTable))]
      public IHttpActionResult PostTimeTable(TimeTable timeTable)
      {
          if (!ModelState.IsValid)
          {
              return BadRequest(ModelState);
          }
          if (ModelState.IsValid)
          {
              DateTime dt = DateTime.Today;
              TimeTable c = (from x in db.TimeTables
                  where x.Company == timeTable.Company &amp;&amp; x.INN == timeTable.INN
                  select x).First();
              c.StartPause = timeTable.StartPause;
              c.StartDay = timeTable.StartDay;
              c.EndPause = timeTable.EndPause;
              c.EndDay = timeTable.EndDay;
              db.SaveChanges();
          }
  
          db.TimeTables.Add(timeTable);
          db.SaveChanges();
  
          return CreatedAtRoute("DefaultApi", new { id = timeTable.Id }, timeTable);
      }
  </code></pre>
  
  <p>But it works well when record with INN and Company already in db.</p>
  
  <p>But if it not in database I need to create new entry.</p>
  
  <p>How I need to modify  this method?</p>