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); }
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"); } }
public ProfileModel() { OVisitorProfile = new VisitorProfile(); }
public AccessHistory(Guid id, string visitorName, VisitorProfile profile) : this(visitorName, profile) { UserId = id; }
public AccessHistory(string visitorName, VisitorProfile profile) { ChangeVisitorName(visitorName); ChangeProfile(profile); }
public async Task InsertVisitor(User user, User visitor, VisitorProfile profile) { var visitorProfile = new AccessHistory(user.Id, visitor.Name, profile); await _accessHistoryRepository.InsertAsync(visitorProfile); }
public void UpdateVisitor(VisitorProfile model) { using (var db = new MovieFinderEntities()) { } }