Beispiel #1
0
        private int GetIdType(string name)
        {
            if (name == null && name.Trim().Length < 0)
            {
                return(-1);
            }                                                         // програма не злетить але треба подумати щоб це значеннє не записалось в базу

            var type = typeRepository.GetByName(name);

            if (type == null)
            {
                typeRepository.Insert(name);
                type = typeRepository.GetByName(name);
            }
            return(type.Id);
        }