// GET: Abonnements/Create public ActionResult CreateForAdherent(int adherentId) { Abonnement abo = new Abonnement(); abo.AdherentId = adherentId; abo.FormuleId = 0; ViewBag.LieuId = new SelectList(_applicationDbContext.Lieux, "LieuId", "LieuNom"); ViewBag.ActiviteId = new SelectList(_applicationDbContext.Activites, "ActiviteId", "ActiviteNom"); ViewBag.FormuleId = new SelectList(_applicationDbContext.Formules, "FormuleId", "FormuleNom"); return PartialView("_CreateForAdherent", abo); }
public static BusinessRuleResult CanDelete(ApplicationDbContext context, Abonnement abonnement) { if (abonnement == null) return new BusinessRuleResult { Success = false, Message = "L'abonnement n'existe pas." }; // TODO check if reglements in same period than the abonnement => not deletable /* bool hasReglements = context.Reglements.Where(r => r.AbonnementId == abonnement.AbonnementId) .Any(); if (hasReglements) return new BusinessRuleResult() { Success = false, Message = "L'abonnement ne peut être supprimée car des règlements y sont liées." }; else return new BusinessRuleResult() { Success = true }; */ return new BusinessRuleResult() { Success = true }; }