Exemple #1
0
        public ActionResult EditPatient(PatientDetailsBasicInfoViewModel patientBasic)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_EditBasicInfoPartialView", patientBasic));
            }


            var patientbasicinfo = _patientServices.GetPatientById(patientBasic.PatientId);

            patientbasicinfo.Firstname     = patientBasic.Firstname;
            patientbasicinfo.Lastname      = patientBasic.Lastname;
            patientbasicinfo.Middle        = patientBasic.Middle;
            patientbasicinfo.DoB           = new DateTime(patientBasic.yearint, patientBasic.monthint, patientBasic.dateint);
            patientbasicinfo.AddStreetBrgy = patientBasic.AddStreetBrgy;
            patientbasicinfo.Muncity       = patientBasic.Municipality;
            patientbasicinfo.Province      = patientBasic.Province;
            patientbasicinfo.Gender        = patientBasic.Gender;
            patientbasicinfo.ContactCell   = patientBasic.ContactCell;


            _patientServices.UpdatePatient(patientbasicinfo);
            _unitofwork.Commit();


            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
        private void RegisterCommand()
        {
            FilterCommand = new RelayCommand(async() =>
            {
                await _patientServices.GetPatient(Filter).ContinueWith(tResult =>
                {
                    Patients.Clear();
                    foreach (var patient in tResult.Result)
                    {
                        Patients.Add(_entityMapper.Map <Patient, PatientViewModel>(patient));
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            });

            UpdateCommand = new RelayCommand(async() =>
            {
                await _patientServices.UpdatePatient(_entityMapper.Map <PatientViewModel, Patient>(CurrentPatient)).ConfigureAwait(false);
            });
        }