Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Deleting Entity not working #3309


User avatar
0
juslwk created

My delete entity is not working, any possible reasons? I have tried Delete And DeleteAsync methods as well. This is the way I test it.

public void DeleteFile(EntityDto input)
        {
            var fileToBeDeleted = _fileRepository.Get(input.Id);
            _fileRepository.DeleteAsync(fileToBeDeleted);
            var deletedFile = _fileRepository.Get(input.Id);
        }

I put a break point after var deletedFile, and check their values, but both fileToBeDeleted & deletedFile are equal in value. Am I doing something wrong? Thank you EDIT There are no error messages or exceptions occurring.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @juslwk,

    You need to call untOfWork.SaveChanges after DeleteAsync if you want changes to effect.

    Thanks.

  • User Avatar
    0
    juslwk created

    Yes thank you, it works now