public ActionResult <bool> CommentOnPatient(string patientId, CarerComments comment) { var claimsIdentity = this.User.Identity as ClaimsIdentity; var carerNameClaim = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; var x = _patientService.CommentOnPatient(carerNameClaim, patientId, comment); return(x); }
public bool CommentOnPatient(string carerName, string patientId, CarerComments comment) { var patient = _patients.Find(c => c.Id == patientId).FirstOrDefault();//get the patient if (patient != null) { comment.CarerName = carerName;//adding the current logged in user to the db as the person who commented //update patients comments in the database _patients.UpdateOneAsync( Builders <Patient> .Filter.Eq(x => x.Id, patient.Id), Builders <Patient> .Update.AddToSet(x => x.Comments, comment)); return(true); } return(false); }