Ejemplo n.º 1
0
        public int CopToSQL(string business_id, [FromQuery] string access_token)
        {
            int count = 0;

            if (access_token != "@bazavietnam")
            {
                return(count);
            }
            var fb = new FirebaseReferralRepository(new FirebaseFactory(_appSettings));

            foreach (var t in fb.GetAll(business_id, new Paging {
                Limit = 10
            }))
            {
                count++;
                _referralService.Create(t);
            }
            return(count);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CurrentVisit(CurrentVisitVM vm)
        {
            if (vm.State == StateVisit.Completed)
            {
                return(RedirectToAction("TimeTable", "Home", new { area = "Doctor" }));
            }

            if (vm.selectedMedicaments != null && vm.selectedMedicaments.Count > 0)
            {
                var medicament = await _medicamentService.GetMedicamentByName(vm.selectedMedicaments);

                var prescriptionInDTO = new PrescriptionInDTO()
                {
                    Comments    = vm.DescriptionPrescription,
                    VisitId     = vm.VisitID,
                    Medicaments = medicament
                };
                await _prescriptionService.Create(prescriptionInDTO);
            }

            if (!string.IsNullOrEmpty(vm.selectedSpecialization))
            {
                var selectedSpecialization = await _specializationService.GetByNameAsync(vm.selectedSpecialization);

                var referralInDTO = new ReferralInDTO()
                {
                    Description      = vm.DescriptionReferral,
                    VisitId          = vm.VisitID,
                    SpecializationId = selectedSpecialization.First().SpecializationId
                };
                await _referralService.Create(referralInDTO);
            }

            await _visitService.UpdateVisit(new UpdateVisitInDTO()
            {
                Description = vm.DescriptionVisit, Id = vm.VisitID, State = StateVisit.Completed
            });

            return(View("Index"));
        }