예제 #1
0
 public void SetUserToTram(User user, int?tramId)
 {
     if (tramId != null && DoesTramExist((int)tramId))
     {
         TramContext.SetUserToTram(TramContext.GetTram((int)tramId), user);
     }
     else
     {
         TramContext.SetUserToTram(null, user);
     }
 }
        private void SetUserToTrams(User user)
        {
            var tramId = (int?)_tramContext.GetTramByDriver(user)?["TramFk"];

            if (tramId != null && tramId != user.TramId)
            {
                _tramContext.SetUserToTram(tramId.Value, null);
            }

            if (user.TramId != null)
            {
                _tramContext.SetUserToTram(user.TramId.Value, user.Id);
            }
        }