public SocialHistory AddHistory(SocialHistory Sochistry) { SocialHistory soc = _socialhistory.FindAll().OrderBy(p => p.SocialHistId).Last(); Sochistry._id = ObjectId.GenerateNewId().ToString(); Int32 sochistid = soc.SocialHistId + 1; Sochistry.SocialHistId = sochistid; if (Sochistry.EncounterType == "P") { Sochistry.EncounterType = "I,A"; } _socialhistory.Insert(Sochistry); return(Sochistry); }
public SocialHistory UpdatePatient(SocialHistory SocialHistory) { var sochistryexist = GetByUserId(SocialHistory.UserId); if (SocialHistory.EncounterType == "P") { if (SocialHistory.UserId != "a8a56c1d-203c-4c53-9d95-972dec7a2ef5" || SocialHistory.UserId == "b6c625f5-653a-429f-b134-5b4d128ce4e8" || SocialHistory.UserId == "a24e6d62-414d-4434-bbe3-b3eec3a026e7") { SocialHistory.EncounterType = "I,A"; } } SocialHistory socht = sochistryexist.Where(p => p._id == SocialHistory._id).First(); socht.SocialHistoryItem = SocialHistory.SocialHistoryItem; socht.Description = SocialHistory.Description; socht.SNOMEDCT = SocialHistory.SNOMEDCT; _socialhistory.Save(socht); return(socht); }