title: Which is good practice and why, if I can achieve same functionality with stored procedure?
body: <pre><code>using (var db = new PoContext())
  {
      var maxSrno = db.poDtInfo.Where(x =&gt; x.Job_Code_Id == Convert.ToInt16(jobcodeID)).Select(x =&gt; x.Po_Dt_Id).Max();
      if (maxSrno == null)
          maxSrno = jobcodeID + 102 + 10000001;
      else
          maxSrno = Convert.ToString(Convert.ToInt64(maxSrno) + 1).ToString();  //Convert.ToInt64(maxSrno) + 1 .ToString();
      var newPo = new PoDtInfo();
      JsonConvert.PopulateObject(values, newPo);
      newPo.Po_Dt_Id = maxSrno;
      db.poDtInfo.Add(newPo);
      db.SaveChanges();
      result = true;
  }
  </code></pre>