public bool Remove(string cohortId)
        {
            Guid id = Utils.ToGuid(cohortId);

            using (var dbContext = new MedialynxDbCohortContext()) {
                if (id != Guid.Empty)
                {
                    string sid    = id.ToString("B");
                    Cohort cohort = dbContext.Cohorts.FirstOrDefault(c => c != null && c.Id == sid);
                    if (cohort != null)
                    {
                        dbContext.Cohorts.Remove(cohort);
                        dbContext.SaveChanges();

                        using (var dbContextLinks = new MedialynxDbCohortEnumLinkContext()) {
                            List <CohortEnumLink> links = dbContextLinks.CohortEnumLink.Where(link => link != null && link.CohortId == sid).ToList();
                            dbContextLinks.RemoveRange(links);
                            dbContextLinks.SaveChanges();
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
 public void Add(Cohort cohort)
 {
     using (var dbContext = new MedialynxDbCohortContext()) {
         dbContext.Cohorts.Add(cohort);
         dbContext.SaveChanges();
     }
 }
 public void Update(Cohort cohort)
 {
     using (var dbContext = new MedialynxDbCohortContext()) {
         Cohort existsCohort = dbContext.Cohorts.FirstOrDefault(coh => coh != null && coh.Id == cohort.Id);
         if (existsCohort != null)
         {
             if (Utils.CopyPropertyValues <Cohort>(cohort, existsCohort))
             {
                 dbContext.Cohorts.Update(existsCohort);
                 dbContext.SaveChanges();
             }
         }
     }
 }