none
Don't Refresh page on Delete MVC 5 Entity Framework6

    Question

  • I am using foreach loop to Delete items on a page. Delete is working but is refreshing the page so user's can't see that the item is deleted. I don't want that. Below is my code. 

    public async Task<ActionResult> Delete(int contId)
            {
    			try
    			{
    
                    var doc = _docResp
    			        .Queryable()
    			        .Include(x => x.ConSub.Headers)
    			        .Include(x => x.TestSub)
                        .Include(x => x.Statuses)
                        .Include(x => x.Feeds)
                        .Where(x => x.DocumentId == contId).ToList();
    
                    foreach (var u in doc)
                    {
                     
                        _uow.RepositoryAsync<Document>().Delete(u);
                    }
                    
    
    
    
                    await _uow.SaveChangesAsync();
    			  
    			    return RedirectToAction("Index", "Cars");
    			}


    Ebenezer

    Wednesday, February 22, 2017 7:18 PM

Answers