public MedicationAllergie AddAllergie(MedicationAllergie medallerg) { var session = HttpContext.Current.Session; if (session["UserId"] != null) { userId = session["UserId"].ToString(); } MedicationAllergie alg = _Allergies.AddAllergie(medallerg); EncounterReport erp = new EncounterReport(); erp.RefId = alg._id; erp.PatientId = alg.UserId; erp.UpdateBy = userId; erp.Action = "Add new MedicationAllergie"; var encreports = encrepo.AddEncReport(erp); return(alg); }