예제 #1
0
 public ActionResult AddCatBallet(CategorieBallet catBallet)
 {
     if (catBallet != null)
     {
         catBalletDal.Add(catBallet);
     }
     else
     {
         ModelState.AddModelError("Catégorie de ballets", "Catégorie introuvable.");
     }
     return(Redirect("CategorieManager"));
 }
예제 #2
0
        public int Update(CategorieBallet catBallet)
        {
            CategorieBallet existCatBallet = Get(catBallet.id);

            if (existCatBallet == null)
            {
                return(-1);
            }
            else
            {
                existCatBallet.lbl = catBallet.lbl;
                return(bdd.SaveChanges());
            }
        }
예제 #3
0
 public CategorieBallet Get(CategorieBallet catBallet)
 {
     return(bdd.CategorieBallet.Where(c => c.lbl.Equals(catBallet.lbl) && c.id == catBallet.id).FirstOrDefault());
 }
예제 #4
0
 public int Delete(CategorieBallet catBallet)
 {
     bdd.CategorieBallet.Remove(catBallet);
     return(bdd.SaveChanges());
 }
예제 #5
0
        public int Delete(string lbl)
        {
            CategorieBallet catBallet = Get(lbl);

            return(Delete(catBallet));
        }
예제 #6
0
        public int Delete(int id)
        {
            CategorieBallet catBallet = Get(id);

            return(Delete(catBallet));
        }
예제 #7
0
 public int Add(CategorieBallet catBallet)
 {
     bdd.CategorieBallet.Add(catBallet);
     return(bdd.SaveChanges());
 }