public LabResult UpdatePatient(LabResult labsres) { var labreexist = GetByUserId(labsres.UserId); if (labsres.EncounterType == "P") { if (labsres.UserId != "a8a56c1d-203c-4c53-9d95-972dec7a2ef5" || labsres.UserId == "b6c625f5-653a-429f-b134-5b4d128ce4e8" || labsres.UserId == "a24e6d62-414d-4434-bbe3-b3eec3a026e7") { labsres.EncounterType = "I,A"; } } LabResult labs = labreexist.Where(p => p._id == labsres._id).First(); labs.OrderableTestName = labsres.OrderableTestName; labs.LONICCode = labsres.LONICCode; labs.TestResultValue = labsres.TestResultValue; labs.DatePerformed = labsres.DatePerformed; _labresult.Save(labs); return(labs); }