public void EditConsultant(ConsultantsViewModel consultant)
        {
            Consultant oldConsultant = GetConsultantById(consultant.ConsultantId.Value);

            _context.Consultants.Attach(oldConsultant);

            oldConsultant.LastUpdate     = DateTime.Now;
            oldConsultant.ReminderDate   = DateTime.Now.AddMonths(1);
            oldConsultant.FirstName      = consultant.FirstName;
            oldConsultant.LastName       = consultant.LastName;
            oldConsultant.ImageURL       = consultant.ImageURL;
            oldConsultant.SpecialistArea = consultant.SpecialistArea;
            oldConsultant.ConsultantDesc = consultant.ConsultantDesc;
            oldConsultant.Phone          = consultant.Phone;
            oldConsultant.Email          = consultant.Email;
            oldConsultant.Website        = consultant.Website;
            oldConsultant.Address1       = consultant.Address1;
            oldConsultant.Address2       = consultant.Address2;
            oldConsultant.Suburb         = consultant.Suburb;
            oldConsultant.PostalCode     = consultant.PostalCode;
            oldConsultant.City           = consultant.City;
            oldConsultant.Country        = consultant.Country;

            _context.SaveChanges();
        }
        public void DisapproveConsultant(int id)
        {
            Consultant consultant = GetConsultantById(id);

            _context.Consultants.Attach(consultant);
            consultant.IsApproved = 0;
            _context.SaveChanges();
        }
        public void DeleteMyConsultants(string userId)
        {
            IEnumerable <ConsultantsViewModel> myConsultants = GetMyConsultants(userId, null);

            foreach (ConsultantsViewModel consultantViewModel in myConsultants)
            {
                Consultant consultant = GetConsultantById(consultantViewModel.ConsultantId.Value);
                RemoveConsultant(consultant);
            }
        }
 public void AddConsultant(Consultant consultant)
 {
     _context.Consultants.Add(consultant);
     _context.SaveChanges();
 }
 public void RemoveConsultant(Consultant consultant)
 {
     _context.Consultants.Remove(consultant);
     _context.SaveChanges();
 }