/// <summary>
 /// Removes a PatientProblem from the Repository.
 /// </summary>
 /// <param name="entity">The PatientProblem to remove from the Repository.</param>
 public void Remove(PatientProblem entity)
 {
     Session.Delete(entity);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a disease to a patient
        /// </summary>
        /// <returns></returns>
        public JsonResult AddDiseaseToPatient()
        {
            try
            {
                var patientId = int.Parse(Request.Form["patientId"]);
                var problemId = int.Parse(Request.Form["problemId"]);

                PatientRepository repo = new PatientRepository();
                var patient = repo.Get(patientId);

                PatientProblemRepository patientProbRepo = new PatientProblemRepository();
                ProblemRepository pRepo = new ProblemRepository();
                PatientProblem pProblem = new PatientProblem();

                pProblem.Problem = pRepo.Get(problemId);
                pProblem.Patient = patient;

                patientProbRepo.Add(pProblem);

                return Json(new
                {
                    error = "false",
                    Name = pProblem.Problem.ProblemName
                });

            }
            catch (Exception)
            {
                return Json(new
                {
                    error = "true"
                });
            }
        }
 /// <summary>
 /// Adds a PatientProblem to the Repository.
 /// </summary>
 /// <param name="entity">The PatientProblem to add to the Repository.</param>
 public void Add(PatientProblem entity)
 {
     Session.Save(entity);
 }