private bool UpdateEntitiesOnUpload(Client currentClient, Document entity, String pathFile, Boolean isImage, IDocumentLogRepository repoLog) { FileInfo f = new FileInfo(pathFile); repoLog.includes.Add("ResourceConfig"); DocumentLog logEntity = repoLog.GetDocumentLogById(currentClient.Id); entity.SizeDocument = f.Length; entity.Url = pathFile.Replace(WebApiApplication.UPLOAD_FOLDER_ROOT, string.Empty); entity.DateUpload = DateTime.Now; logEntity.CurrentSize += DocumentUtils.GetAllDocumentsSize(f.Length, pathFile, isImage); logEntity.DateModification = DateTime.Now; if (!((DocumentValidation)validation).CheckSizeUpload(validationDictionnary, logEntity)) { return(false); } repo.Update(entity); repo.Save(); repoLog.Update(logEntity); repoLog.Save(); return(true); }