Exemplo n.º 1
0
        public VisitorProfile UpdateVisitorProfile(Guid?sessionID, string ip, string url, string language = "")
        {
            VisitorProfile vp = null;

            using (var db = new MovieFinderEntities())
            {
                if (sessionID != null)
                {
                    vp = db.VisitorProfiles.FirstOrDefault(x => x.ID == sessionID);
                }
                if (vp == null)
                {
                    vp = new VisitorProfile {
                        LastAccessedLanguage = ""
                    };
                    db.VisitorProfiles.Add(vp);
                }
                vp.LastAccessedIP       = ip;
                vp.LastAccessedLanguage = language ?? vp.LastAccessedLanguage;
                vp.LastAccessedTime     = DateTime.Now;
                vp.LastAccessedUrl      = url;
                vp.HitCount++;
                db.SaveChanges();
            }


            return(vp);
        }
Exemplo n.º 2
0
        public void ChangeProfile(VisitorProfile newProfile)
        {
            if (Profile.Equals(newProfile))
            {
                return;
            }

            Profile = newProfile;
        }
 public VisitorProfile Add(VisitorProfile visitorProfile)
 {
     using (var _ctx = new DatingContext())
     {
         _ctx.Entry <VisitorProfile>(visitorProfile).State = System.Data.Entity.EntityState.Added;
         _ctx.SaveChanges();
         return(visitorProfile);
     }
 }
 //Add visitorProfile
 public VisitorProfile Add(VisitorProfile visitorProfile)
 {
     try
     {
         return(_visitorProfileRepository.Add(visitorProfile));
     }
     catch (Exception e)
     {
         //Log Error
         throw new Exception("An error occurred while trying to add a visitor profile");
     }
 }
Exemplo n.º 5
0
 public ProfileModel()
 {
     OVisitorProfile = new VisitorProfile();
 }
Exemplo n.º 6
0
 public AccessHistory(Guid id, string visitorName, VisitorProfile profile) : this(visitorName, profile)
 {
     UserId = id;
 }
Exemplo n.º 7
0
 public AccessHistory(string visitorName, VisitorProfile profile)
 {
     ChangeVisitorName(visitorName);
     ChangeProfile(profile);
 }
Exemplo n.º 8
0
        public async Task InsertVisitor(User user, User visitor, VisitorProfile profile)
        {
            var visitorProfile = new AccessHistory(user.Id, visitor.Name, profile);

            await _accessHistoryRepository.InsertAsync(visitorProfile);
        }
Exemplo n.º 9
0
 public void UpdateVisitor(VisitorProfile model)
 {
     using (var db = new MovieFinderEntities())
     {
     }
 }