0
troyfernando created
public async Task Delete(EntityDto input) { int parentID = _estimatecuttinglistRepository.FirstOrDefault(input.Id).parentID;
_estimatecuttinglistRepository.Delete(input.Id); -- records not deleted
await Updateitemno(parentID, true); -- executed
}
I having problem when deleting records after i insert the Updateitemno command.
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
6 Answer(s)
-
0
Please share the complete code and error stack information.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
No errors found. it seems updateitemno method is affecting the delete command. it works when i remove updateitemno method.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Please share the code of
Updateitemnomethod .Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
public Task Updateitemno(int parentID, bool isNew) { DNEthanRepositoryExtensions.updateitemno<Estimatecuttinglist, int>(_estimatecuttinglistRepository, parentID, isNew); return Task.CompletedTask; }
public static void updateitemno<TEntity, TPrimaryKey>(this IRepository<TEntity, TPrimaryKey> repository, int parentID , bool isNeworDelete) where TEntity : class, IEntity<TPrimaryKey>, IMayHaveItemno { if (!isNeworDelete) return; var item = from db in repository.GetAll() where db.parentID == parentID orderby db.itemno select db; int itemno = 1; foreach (var row in item) { row.itemno = itemno; repository.Update(row); itemno++; } }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Please try
unitOfWorkManager.Current.SaveChangesAsync(public async Task Delete(EntityDto input) { int parentID = _estimatecuttinglistRepository.FirstOrDefault(input.Id).parentID; _estimatecuttinglistRepository.Delete(input.Id); -- records not deleted await _unitOfWorkManager.Current.SaveChangesAsync(); await Updateitemno(parentID, true); -- executed }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
thanx
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)