/// <summary>
        /// Function to delete entity whose primary key is passes.
        /// </summary>
        /// <param name="pk">Primary key of entity to be deleted</param>
        /// <param name="context">context to maintain transaction</param>
        public void Delete(object pk, CompatibilityEntities context)
        {
            DbSet <T> table    = context.Set <T>();
            T         existing = table.Find(pk);

            context.Entry(existing).State = EntityState.Deleted;
        }
        /// <summary>
        /// Function to update entity.
        /// </summary>
        /// <param name="entity">entity to be updated</param>
        /// <param name="context">context to maintain transaction</param>
        public void Update(T entity, CompatibilityEntities context)
        {
            DbSet <T> table = context.Set <T>();

            table.Attach(entity);
            context.Entry(entity).State = EntityState.Modified;
        }
 /// <summary>
 /// Function to update entity.
 /// </summary>
 /// <param name="entity">entity to be updated</param>
 public string Update(T entity)
 {
     try
     {
         using (CompatibilityEntities context = new CompatibilityEntities())
         {
             DbSet <T> table = context.Set <T>();
             table.Attach(entity);
             context.Entry(entity).State = EntityState.Modified;
             context.SaveChanges();
             return(string.Empty);
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="pk">Primary key of entity to be deleted</param>
        public string Delete(object pk)
        {
            try
            {
                using (CompatibilityEntities context = new CompatibilityEntities())
                {
                    DbSet <T> table = context.Set <T>();

                    T existing = table.Find(pk);
                    context.Entry(existing).State = EntityState.Deleted;
                    context.SaveChanges();
                    return(string.Empty);
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }