Example #1
0
        public async Task <ActionResult> CreateApp(AppDeptViewModel vm, IFormCollection collection)
        {
            var app = new TestRegister
            {
                Date      = DateTime.Now,
                PatientId = vm.PatientId,
                TId       = vm.TestId,
                Result    = new TestResult
                {
                    Id = vm.ResultId
                }

                //Patients = new PatientForm
                //{
                //    Fullname = vm.Fullname,
                //    Age = vm.Age,
                //    ClinicalDiagnosis = vm.ClinicalDiagnosis,
                //    DateOfRequest = vm.DateOfRequest,
                //    Physician = new Physician
                //    {
                //        PhysicianName = vm.Physician
                //    }
                //},
                //Tests = /*(from product in _ctx.Tests new PatientTest)*/{

                //},

                //    Result = new TestResult
                //    {
                //        IsCompleted = vm.IsCompleted
                //    },
            };

            try
            {
                _testRepo.AddAppointment(app);
                await _testRepo.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(app));
            }
        }