Пример #1
0
        private List <View_BloodTypes> GetBloodTypes()
        {
            List <BloodType> bloodTypes = PatientCRUD.GetBloodTypes();

            List <View_BloodTypes> blodtyps = (from bt in bloodTypes
                                               select new View_BloodTypes
            {
                Id = bt.Id.ToString(),
                Antigen = bt.Antigen,
                RHFactor = bt.RHFactor
            }).ToList();

            return(blodtyps);
        }
        private List <View_Countries> GetCountries()
        {
            List <Country> countries = PatientCRUD.GetCountries();

            List <View_Countries> ctrs = (from co in countries
                                          select new View_Countries
            {
                Id = co.Id.ToString(),
                Name = co.Name,
                Acron = co.Acron
            }).ToList();

            return(ctrs);
        }
        public ActionResult Update(int key, View_Patient patient)
        {
            try
            {
                //Audit log
                AuditCRUD.CreateAuditMesssageAndInsertMessage(false, "INITIATE PATIENT UPDATE", "PatientsController");

                PatientCRUD.UpdatePatient(key, patient);

                return(new HttpStatusCodeResult(200));
            }
            catch (Exception ex)
            {
                AuditCRUD.CreateAuditMesssageAndInsertMessage(true, "ERROR ON PATIENT UPDATE", "PatientsController", ex.StackTrace);
                return(new HttpStatusCodeResult(500));
            }
        }
        public ActionResult Post(View_Patient values)
        {
            try
            {
                //Audit log
                AuditCRUD.CreateAuditMesssageAndInsertMessage(false, "INITIATE NEW PATIENT INSERTION", "PatientsController");

                PatientCRUD.AddPatient(values);

                return(new HttpStatusCodeResult(200));
            }
            catch (Exception ex)
            {
                AuditCRUD.CreateAuditMesssageAndInsertMessage(true, "ERROR ON NEW PATIENT INSERTION", "PatientsController", ex.StackTrace);
                return(new HttpStatusCodeResult(500));
            }
        }
        private AjaxResp GetPatients()
        {
            List <Patient> patients = PatientCRUD.SelectPatient();

            //Due to Guid not being serializable...
            List <View_Patient> vpatients = (from pp in patients
                                             select new View_Patient
            {
                id = pp.id,
                FirstName = pp.FirstName,
                LastName = pp.LastName,
                DateOfBirth = pp.DateOfBirth,
                Country = pp.Country.Id.ToString(),
                Phone = pp.Phone,
                Diseases = pp.Diseases,
                BloodType = pp.BloodType.Id.ToString()
            }).ToList();

            return(new AjaxResp {
                totalCount = patients.Count, items = vpatients
            });
        }