コード例 #1
0
ファイル: PLMPackLib.DAL.cs プロジェクト: minrogi/PLMPackLib
 public static CardboardFormat CreateNew(PLMPackLibDb db, string name, string description, float length, float width)
 {
     // is already existing ?
     if (Exists(db, name))
         throw new Exception(string.Format("CardboardFormat with name = {0} already exists", name));
     // build new cardboard format
     CardboardFormat cardboardFormat = new CardboardFormat();
     cardboardFormat.Name = name;
     cardboardFormat.Description = description;
     cardboardFormat.Length = length;
     cardboardFormat.Width = width;
     db.CardboardFormats.Add(cardboardFormat);
     db.SaveChanges();
     return cardboardFormat;
 }
コード例 #2
0
        public static CardboardFormat CreateNew(PLMPackLibDb db, string name, string description, float length, float width)
        {
            // is already existing ?
            if (Exists(db, name))
            {
                throw new Exception(string.Format("CardboardFormat with name = {0} already exists", name));
            }
            // build new cardboard format
            CardboardFormat cardboardFormat = new CardboardFormat();

            cardboardFormat.Name        = name;
            cardboardFormat.Description = description;
            cardboardFormat.Length      = length;
            cardboardFormat.Width       = width;
            db.CardboardFormats.Add(cardboardFormat);
            db.SaveChanges();
            return(cardboardFormat);
        }