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; }
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); }