Exemplo n.º 1
0
        public static UserTestimonial GetByID(int UserTestimonialID, IEnumerable <string> includeList = null)
        {
            UserTestimonial obj = null;
            string          key = cacheKeyPrefix + UserTestimonialID + GetCacheIncludeText(includeList);

            UserTestimonial tmpClass = null;

            if (Cache.IsEnabled)
            {
                if (Cache.IsEmptyCacheItem(key))
                {
                    return(null);
                }
                tmpClass = Cache[key] as UserTestimonial;
            }

            if (tmpClass != null)
            {
                obj = tmpClass;
            }
            else
            {
                using (Entities entity = new Entities())
                {
                    IQueryable <UserTestimonial> itemQuery = AddIncludes(entity.UserTestimonial, includeList);
                    obj = itemQuery.FirstOrDefault(n => n.UserTestimonialID == UserTestimonialID);
                }
                Cache.Store(key, obj);
            }

            return(obj);
        }
Exemplo n.º 2
0
 public UserTestimonial(UserTestimonial objectToCopy)
 {
     GiverNameAndLocation = objectToCopy.GiverNameAndLocation;
     Testimonial          = objectToCopy.Testimonial;
     UserID            = objectToCopy.UserID;
     UserTestimonialID = objectToCopy.UserTestimonialID;
 }