public static bool IsDuplicate(string code)
        {
            var exists = false;

            using (var db = new AvDb())
            {
                exists = db.Histories.Any(x => x.Code.Replace("-", String.Empty).ToUpper() == code.Replace("-", String.Empty).ToUpper());
            }

            return exists;
        }
        public static void Create(string code, string name)
        {
            var history = new History()
            {
                Code = code,
                AvName = name
            };

            using (var db = new AvDb())
            {
                db.Entry(history).State =EntityState.Added;
                db.SaveChanges();
            }
        }