public DbStatus AddParticipantToStudyDB(int partID, int studyID)
        {
            DbStatus         manageParticipantStatus = new DbStatus();
            Studyparticipant studpart = _context.Studyparticipant.FirstOrDefault(x => x.IdStudy == studyID && x.IdParticipant == partID);

            if (studpart == null)
            {
                Participant participant = _context.Participant.FirstOrDefault(part => part.IdParticipant == partID);
                if (participant != null)
                {
                    //Participant exists, but is not enrolled.
                    studpart = new Studyparticipant();
                    studpart.IdParticipant = partID;
                    studpart.IdStudy       = studyID;
                    _context.Studyparticipant.Add(studpart);
                    _context.SaveChanges();
                    manageParticipantStatus.success = true;
                }
                else
                {
                    //Participant with this ID does not exists.
                    manageParticipantStatus.success      = false;
                    manageParticipantStatus.errormessage = "Participant with this ID does not exist in the system";
                }
            }
            else
            {
                //Participant allready enrolled in study
                manageParticipantStatus.success      = false;
                manageParticipantStatus.errormessage = "Participant is already enrolled instudy.";
            }
            return(manageParticipantStatus);
        }
        public DbStatus RemoveParticipantFromStudyDB(int partID, int studyID)
        {
            DbStatus         manageParticipantStatus = new DbStatus();
            Studyparticipant studPart = _context.Studyparticipant.FirstOrDefault(x => x.IdParticipant == partID && x.IdStudy == studyID);

            if (studPart != null)
            {
                //Participant is enrolled in study
                _context.Studyparticipant.Remove(studPart);
                _context.SaveChanges();
                manageParticipantStatus.success = true;
            }
            else
            {
                //Participant is not enrolled in study
                manageParticipantStatus.errormessage = "Participant is not enrolled in study";
                manageParticipantStatus.success      = false;
            }
            return(manageParticipantStatus);
        }