public ActionResult Assign(int conflictId, string arbiterId) { 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 || !demandeur.UserCompany.Company.isFilled() || defendeur.UserCompany == null || defendeur.UserCompany.Company == null || !defendeur.UserCompany.Company.isFilled()) { TempData["Error"] = "Vous devez avoir rempli les formulaires administratif des parties (adresses,rcs,etc) avant de pouvoir assigner le cas."; return(RedirectToAction("Conflict", "Viewer", new { conflictId = conflictId })); } BLLArbiter.AssignArbiterToConflict(conflictId, arbiterId); var arbiter = BLLUsers.GetUserById(arbiterId); //Generate Mission Order and save it on cloud var stream = DocGenerator.GenerateMissionOrder(conflictId); var blob = AzureFileHelper.AddFile(conflictId, stream.FileStream, stream.FileName); stream.FileStream.Dispose(); BLLLegalDocuments.AddLegalDocument(new LegalDocument() { IdConflict = conflictId, Filename = stream.FileName, Url = blob.Uri.AbsoluteUri, Type = (int)LegalDocumentTypeEnum.MissionAct }); Guid guid = Guid.NewGuid(); FastArbitreEmails.NewMissionOrder(arbiter.Email, blob.Uri.AbsoluteUri, Request.UrlReferrer.DnsSafeHost + Url.Action("Index", "Email", new { id = guid.ToString() }), guid); return(RedirectToAction("Centre")); }