title: Delete row from grid and database with Kendo UI and MVC
body: <p>I'm using a MVC project with Visual Studio 2012 and Kendo UI 2014.</p>
  
  <p>I <strong>can delete a row from the grid</strong> and it disappears, but when I reload the page, the row that I deleted re-appears. <strong>I would like to remove from the database too.</strong></p>
  
  <p>This is my code:</p>
  
  <p><strong>.cshtml (View):</strong></p>
  
  <pre><code>&lt;div class="grid"&gt;
  @(Html.Kendo().Grid&lt;UsersModel&gt;()
      .Name("grid")
      .DataSource(dataSource =&gt; dataSource
          .Ajax()
          .Read(r =&gt; r.Action("GetAccounts", "ManagerAccounts", new { area = "Admin" }))
          .Model(r =&gt; r.Id(p =&gt; p.Id))
          .Destroy("Delete", "ManagerAccounts")
      )
      .Columns(columns =&gt;
      {
          columns.Bound(c =&gt; c.Id);
          columns.Bound(c =&gt; c.UserName);
          columns.Bound(c =&gt; c.Email);
          columns.Command(command =&gt; command.Destroy()).Width(120);
      })
      .Pageable(pageable =&gt; pageable
          .Refresh(true)
          .PageSizes(true)
          .ButtonCount(5)
      )
      .Scrollable()
      .Sortable()
      .Navigatable()
  )
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>public ActionResult Delete([DataSourceRequest] DataSourceRequest request, Everis.WebApps.Security.Models.ListadoUsuarioModel users)
  {
      if (users != null &amp;&amp; ModelState.IsValid)
      {
          AccountRepository.DeleteUsuarios(users.Id);
      }
  
      return Json(ModelState.ToDataSourceResult());
  }
  </code></pre>
  
  <p><strong>Repository (AccountRepository):</strong></p>
  
  <pre><code>protected ApplicationDbContext Context = new ApplicationDbContext();
  
      public void DeleteUsuarios(string id)
      {
          var usuario = this.Context.Users.FirstOrDefault(x =&gt; x.Id == id);
          if (usuario != null)
          {
              this.Context.Users.Remove(usuario);                
          }
      }
  </code></pre>
  
  <p><strong>IdentityModels (from ApplicationDbContext Context):</strong></p>
  
  <pre><code>public class ApplicationUser : IdentityUser
  {
      public bool Active { get; set; }
  }
  
  public class ApplicationRol : IdentityRole
  {
      public Application Application { get; set; }
  }
  
  public class Application
  {
      public Guid Id { get; set; }
      public string Name { get; set; }
      public bool Active { get; set; }
  }
  
  public class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;
  {
      public ApplicationDbContext()
          : base("DefaultConnection", throwIfV1Schema: false)
      {            
      }
  
      public DbSet&lt;Application&gt; Applications { get; set; }
  
      public new DbSet&lt;ApplicationRol&gt; Roles { get; set; }
  
  } 
  </code></pre>
  
  <p>Any idea to delete from database too?</p>