Ejemplo n.º 1
0
        public async Task <IActionResult> PutTbDoctor(int id, TbDoctor tbDoctor)
        {
            DateTime actual = DateTime.Now;

            tbDoctor.DateUpdatedDoctor = actual;

            if (id != tbDoctor.IdDoctor)
            {
                return(BadRequest());
            }

            _context.Entry(tbDoctor).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TbDoctorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <TbDoctor> > PostTbDoctor(TbDoctor tbDoctor)
        {
            DateTime actual = DateTime.Now;

            tbDoctor.DateCreatedDoctor = actual;

            _context.TbDoctors.Add(tbDoctor);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTbDoctor", new { id = tbDoctor.IdDoctor }, tbDoctor));
        }
        private void BtAddReferral_Click(object sender, RoutedEventArgs e)
        {
            int  nbOfDays;
            bool success;

            if (CbPatient.SelectedItem != null && TbDiagnosis.Text != "" && TbIcd10.Text != "" && DpDateReferral.SelectedDate != null)
            {
                success = int.TryParse(TbNbOfDays.Text, out nbOfDays);
                if (success)
                {
                    MessageBoxResult result = MessageBox.Show("Czy zapisać skierowanie dla pacjenta " + ((Patient)CbPatient.SelectedItem).Name + " " + ((Patient)CbPatient.SelectedItem).Surname + "?", "Zapis", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        Referral.AddReferral(TbDiagnosis.Text, TbIcd10.Text, TbTreatments.Text, TbDoctor.Text, nbOfDays, DpDateReferral.SelectedDate.Value, CbPatient.SelectedItem as Patient, dbcontext);
                        TbDiagnosis.Clear(); TbIcd10.Clear(); DpDateReferral.SelectedDate = null; TbNbOfDays.Clear(); CbPatient.SelectedItem = null; TbTreatments.Clear(); TbDoctor.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("Podaj poprawną liczbę wizyt!");
                }
            }
            else
            {
                MessageBox.Show("Uzupełnij wszystkie dane!");
            }
            referralDataGrid.Items.Refresh();
        }