public int Add(Consultant consultant)
        {
            int newId = _consultants.Max(c => c.ID) + 1;

            consultant.ID = newId;

            _consultants.Add(consultant);
            return(newId);
        }
Example #2
0
        public Consultant AddConsultant(string fullName, string designation, string linkedIn, string blog, string hackernews, string stackoverflow, string github)
        {
            var consultant = new Consultant();

            consultant.Name            = fullName;
            consultant.Designation     = designation;
            consultant.LinkedinProfile = linkedIn;
            consultant.Picture         = DEFAULT_IMAGES.PROFILE_PICTURE;
            consultant.TenantId        = TenantId;

            Consultants.Add(consultant);

            if (!string.IsNullOrEmpty(blog))
            {
                consultant.AddCredential(CREDENTIAL_TYPE.BLOG, blog);
            }
            if (!string.IsNullOrEmpty(hackernews))
            {
                consultant.AddCredential(CREDENTIAL_TYPE.HACKERNEWS, hackernews);
            }
            if (!string.IsNullOrEmpty(stackoverflow))
            {
                consultant.AddCredential(CREDENTIAL_TYPE.STACKOVERFLOW, stackoverflow);
            }
            if (!string.IsNullOrEmpty(github))
            {
                consultant.AddCredential(CREDENTIAL_TYPE.GITHUB, github);
            }

            return(consultant);
        }
Example #3
0
        public async Task GetConsultants()
        {
            if (initialized == true)
            {
                return;
            }
            IsBusy = true;
            IEnumerable <Consultant> consultants = await consultantService.Get();

            // очищаем список
            //Consultations.Clear();
            while (Consultants.Any())
            {
                Consultants.RemoveAt(Consultants.Count - 1);
            }

            // добавляем загруженные данные
            foreach (Consultant c in consultants)
            {
                Consultants.Add(c);
            }
            IsBusy      = false;
            initialized = true;
        }