locked
Don't Refresh page on Delete MVC 5 Entity Framework6 RRS feed

  • 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

  • They'll help you over here in Microsoft official MVC forum

    https://forums.asp.net/1146.aspx/1?MVC

     

     

     



    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    • Proposed as answer by Just Karl Thursday, February 23, 2017 4:18 PM
    • Marked as answer by Dave PatrickMVP Friday, March 3, 2017 2:31 AM
    Wednesday, February 22, 2017 7:22 PM