Ejemplo n.º 1
0
 public void AddLogProfile(string name, Guid globalId, Person owner)
 {
     var logProfile = new LogProfile
     {
         Name = name,
         GlobalId = globalId,
         Person = owner
     };
     _dbContext.LogProfiles.Add(logProfile);
 }
Ejemplo n.º 2
0
        public void Update(Person item)
        {
            var currentUser = _db.People.Include(e => e.LogProfiles).FirstOrDefault(p => p.Email == item.Email);

            if (currentUser != null)
            {
                currentUser.Country = item.Country;
                currentUser.DateOfBirth = item.DateOfBirth;
                currentUser.FirstName = item.FirstName;
                currentUser.LastName = item.LastName;
                currentUser.PostalCode = item.PostalCode;
            }
        }
Ejemplo n.º 3
0
 //public void CreateOrUpdate(Person item)
 //{
 //    var currentUser = _db.People.Include(e => e.LogProfiles).FirstOrDefault(p => p.Email == item.Email);
 //    if (currentUser != null)
 //    {
 //        currentUser.Country = item.Country;
 //        currentUser.DateOfBirth = item.DateOfBirth;
 //        currentUser.FirstName = item.FirstName;
 //        currentUser.LastName = item.LastName;
 //        currentUser.PostalCode = item.PostalCode;
 //    }
 //    else
 //    {
 //        currentUser = new Person
 //            {
 //                Email = item.Email,
 //                Country = item.Country,
 //                DateOfBirth = item.DateOfBirth,
 //                FirstName = item.FirstName,
 //                LastName = item.LastName,
 //                PostalCode = item.PostalCode
 //            };
 //        _db.People.Add(currentUser);
 //    }
 //    if (currentUser.LogProfiles.Count != 0) return;
 //    var logProfile = new LogProfile
 //        {
 //            Name = LogProfile.DefaultName,
 //            GlobalId = Guid.NewGuid(),
 //            Person = currentUser
 //        };
 //    _db.LogProfiles.Add(logProfile);
 //}
 public void Create(Person item)
 {
     var p = new Person
     {
         Email = item.Email,
         Country = item.Country,
         DateOfBirth = item.DateOfBirth,
         FirstName = item.FirstName,
         LastName = item.LastName,
         PostalCode = item.PostalCode
     };
     _db.People.Add(p);
 }
Ejemplo n.º 4
0
 private void CreateOrUpdatePerson(string username)
 {
     if (_logManager.ModelReader.UserExist(username))
     {
         // what I can do with only the username?
     }
     else
     {
         var p = new Person { Email = username };
         _logManager.PersonCommands.Create(p);
         _logManager.LogCommands.AddLogProfile(new LogProfile
         {
             Name = LogProfile.DefaultName,
             Person = p,
             GlobalId = Guid.NewGuid()
         });
         _logManager.Save();
     }
 }