title: Delete method is not working in ASP.NET Core Web API
body: <p>I am using ASP.NET Core Web API in my application get and post method is working fine.</p>
  <p>This is my code:</p>
  <pre><code>public class DepartmentController : Controller
  {
         [HttpGet]
         [Route(&quot;api/Departments&quot;)]
         public List&lt;Department&gt; Get()
         {
              DepartmentDbContext Db = new DepartmentDbContext();
              List&lt;Department&gt; Departments = Db.departments.ToList();
              return Departments;
         }
  
         [HttpPost]
         [Route(&quot;api/Departments&quot;)]      
         public string Post([FromBody] Department department)
         {
              DepartmentDbContext Db = new DepartmentDbContext();      
  
              try
              {
                      Db.departments.Add(department);
                      Db.SaveChanges();
                      // return department;
                      return &quot;Added Successfully&quot;;
              }
              catch (Exception)
              {
                  return &quot;Record Not Added&quot;;
              }    
         }
  }
  </code></pre>
  <p>This code is working fine and also worked fine in postman.</p>
  <p>But the delete method is not working - here is the code:</p>
  <pre><code>[HttpDelete]
  [Route(&quot;api/Departments&quot;)]
  public int Delete(int id)
  {
      DepartmentDbContext Db = new DepartmentDbContext();
  
      try
      {
          Department dept = Db.departments.Where(x =&gt; x.DepartmentID == id).FirstOrDefault();
          Db.departments.Remove(dept);
          Db.SaveChanges();
          return 1; 
      }
      catch(Exception)
      {
          return -1; 
      }
  }
  </code></pre>
  <p>This code is not working in postman</p>