Beispiel #1
0
        public CodeBranch Create(CodeBranch item)
        {
            if (item.IsValid())
            {
                try
                {
                    db.CodeBranches.Add(item);
                    db.SaveChanges();

                    return(item);
                }
                catch (Exception ex)
                {
                    db.CodeBranches.Remove(item);
                    throw ex;
                }
            }
            else
            {
                throw new Exception("CodeBranch is invalid");
            }
        }