Ejemplo n.º 1
0
 public static CardboardProfile CreateNew(PLMPackLibDb db, string code, string name, float thickness)
 {
     // is already exists ?
     if (Exists(db, code))
         throw new Exception(string.Format("Cardboard profile with code = {0} already exists", code));
     // build new cardboard profile
     CardboardProfile cardboardProfile = new CardboardProfile();
     cardboardProfile.Code = code;
     cardboardProfile.Name = name;
     cardboardProfile.Thickness = thickness;
     db.CardboardProfiles.Add(cardboardProfile);
     db.SaveChanges();
     return cardboardProfile;
 }