//public bool IsValidName(string name)
        //{
        //    using (LoanPriceEntities context = new LoanPriceEntities())
        //    {
        //        int count = context.CreditRatings.Where(s => s. == name).Count();
        //        if (count == 0)
        //            return true;
        //        else
        //            return false;
        //    }
        //}
        public string SaveRating(CreditRating rating)
        {
            using (LoanPriceEntities context = new LoanPriceEntities())
            {
                if (rating.ID <= 0)
                {

                    //if (context.CreditRatings.Where(s => s.CreditAgency == rating.CreditAgency).Count() == 0)
                    //{
                        context.AddToCreditRatings(rating);
                        context.SaveChanges();
                        return "Credit Rating is added successfully";
                    //}
                    //else
                    //    return "Entry of the same Currency is already exists.";
                }
                else
                {
                    //if (context.Currencies.Where(s => s.Currancy == currency.Currancy && s.ID != currency.ID).Count() == 0)
                    //{
                    context.CreditRatings.Attach(rating);
                    context.ObjectStateManager.ChangeObjectState(rating, System.Data.EntityState.Modified);
                        context.SaveChanges();
                        return "Credit Rating is Updated successfully";
                    //}
                    //else
                    //    return "Entry of the same Currency is already exists.";
                }
            }
        }