|
|
@@ -148,10 +148,14 @@ namespace CD67.FicheCollege.MVC.Controllers
|
|
|
[ValidateAntiForgeryToken]
|
|
|
public ActionResult DeleteConfirmed(int id)
|
|
|
{
|
|
|
+ ActionEduCollegeFactory aec_fact = new ActionEduCollegeFactory(db);
|
|
|
+ aec_fact.deleteMany(a => a.ActionEduId == id);
|
|
|
+
|
|
|
ActionEduFactory fact = new ActionEduFactory(db);
|
|
|
ActionEdu actionEdu = fact.getById(id);
|
|
|
+ int annee_id = actionEdu.AnneeId;
|
|
|
fact.delete(ref actionEdu);
|
|
|
- return RedirectToAction("Index", new { annee_id = actionEdu.AnneeId });
|
|
|
+ return RedirectToAction("Index", new { annee_id = annee_id });
|
|
|
}
|
|
|
|
|
|
public List<ActionEdu> actions_non_importees(int annee_id)
|
|
|
@@ -164,7 +168,7 @@ namespace CD67.FicheCollege.MVC.Controllers
|
|
|
// Pour chaque college de l'année précédente, on vérifie s'il existe dans l'année en cours en se basant sur le TokenId
|
|
|
if (!db.ActionsEdu.Any(a => a.TokenId == actionEdu.TokenId && a.AnneeId == annee_id))
|
|
|
{
|
|
|
- non_importees.Add(actionEdu.flat());
|
|
|
+ non_importees.Add(actionEdu);
|
|
|
}
|
|
|
}
|
|
|
return non_importees;
|
|
|
@@ -180,7 +184,22 @@ namespace CD67.FicheCollege.MVC.Controllers
|
|
|
|
|
|
ImportActionEduViewModel model = new ImportActionEduViewModel();
|
|
|
model.Annee_Id = annee_id.Value;
|
|
|
- model.set_liste(actions_non_importees(annee_id.Value));
|
|
|
+ model.Annee_Lib = db.Annees.Where(a => a.Id == annee_id.Value).First().Libelle;
|
|
|
+ List<ActionEdu> non_importes = actions_non_importees(annee_id.Value);
|
|
|
+
|
|
|
+ model.set_liste(non_importes);
|
|
|
+
|
|
|
+ for (int i = 0; i < non_importes.Count; i++)
|
|
|
+ {
|
|
|
+ ActionEdu actionEdu = non_importes[i];
|
|
|
+ foreach (ActionEduCollege aec in actionEdu.ActionsEduColleges)
|
|
|
+ {
|
|
|
+ if (!db.Colleges.Where(c=>c.TokenId==aec.College.TokenId && c.Annee_Id == annee_id.Value).Any())
|
|
|
+ {
|
|
|
+ model.actionsEdu_averts[i].Add(aec.College.Libelle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return View(model);
|
|
|
}
|