public ActionResult PreSentence(int conflictId) { var conflict = BLLConflicts.GetConflictForArbitration(conflictId); var demandeur = conflict.UsersInConflicts.First(c => c.IdUser == conflict.IdCreationUser); if (demandeur.IsLawyer != null && demandeur.IsLawyer.Value) { demandeur = conflict.UsersInConflicts.First(c => c.IdLawyer == conflict.IdCreationUser); } var defendeur = conflict.UsersInConflicts.First(c => (c.IsLawyer == null || !c.IsLawyer.Value) && c.IdUser != demandeur.IdUser); if (demandeur.UserCompany == null || demandeur.UserCompany.Company == null || defendeur.UserCompany == null || defendeur.UserCompany.Company == null) { TempData["Error"] = "Vous devez renseigner les informations d'entreprises de chaque parties avant de pouvoir générer la pré-sentence"; return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId })); } var file = DocGenerator.GeneratePreSentenceReport(conflict); var azureFile = AzureFileHelper.AddFile(conflictId, file.FileStream, file.FileName); return(View("WritePreSentence", new WritePreSentenceModel() { Conflict = conflict, Url = azureFile.Uri.AbsoluteUri })); }