Exemple #1
0
 private void medDeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (medicalBillsDataGrid.SelectedItem != null)
     {
         MedicalBillsDTO med = (MedicalBillsDTO)medicalBillsDataGrid.SelectedItem;
         _medicalBillsService.Remove(med);
         medicalBills.Remove(med);
         medicalBillsDataGrid.Items.Refresh();
     }
 }
Exemple #2
0
 public IActionResult Delete(MedicalBillsDTO dTO)
 {
     try
     {
         var med = _medicalBillsService.GetAll().FirstOrDefault(u => u.Id == dTO.Id);
         _medicalBillsService.Remove(med);
         return(RedirectToAction("List"));
     }
     catch
     {
         return(View());
     }
 }
Exemple #3
0
 public IActionResult Create(MedicalBillsViewModel medicalBillsViewModel)
 {
     if (ModelState.IsValid)
     {
         var bill = new MedicalBillsDTO
         {
             Name             = medicalBillsViewModel.Name,
             MedicalBillsType = _medicalBillsTypeService.GetAll().FirstOrDefault(u => u.Type == medicalBillsViewModel.Type),
             Form             = _formService.GetAll().FirstOrDefault(u => u.FormName == medicalBillsViewModel.Form)
         };
         _medicalBillsService.Add(bill);
         return(RedirectToAction("List"));
     }
     return(View());
 }
Exemple #4
0
 public IActionResult Edit(MedicalBillsViewModel medicalBillsViewModel)
 {
     try
     {
         var dTO = new MedicalBillsDTO
         {
             Id               = _medicalBillsService.GetAll().FirstOrDefault(u => u.Id == medicalBillsViewModel.Id).Id,
             Name             = medicalBillsViewModel.Name,
             MedicalBillsType = _medicalBillsTypeService.GetAll().FirstOrDefault(u => u.Type == medicalBillsViewModel.Type),
             Form             = _formService.GetAll().FirstOrDefault(u => u.FormName == medicalBillsViewModel.Form)
         };
         _medicalBillsService.Update(dTO);
         return(RedirectToAction("List"));
     }
     catch
     {
         return(View());
     }
 }
Exemple #5
0
        private void medAddButton_Click(object sender, RoutedEventArgs e)
        {
            MedicalBillsTypeDTO dTO = new MedicalBillsTypeDTO();
            MedicalBillsDTO     med = new MedicalBillsDTO
            {
                Name = medNameTextBox.Text,
                //        Quantity = int.Parse(medQuantityTextBox.Text),
                //        ManufactureId = int.Parse(medManufacturerTextBox.Text),
                ////        MedicalBillsType = int.Parse(medTypeTextBox.Text),
                //        DateOfManufacture = (DateTime)medDateOfManufacturePicker.SelectedDate,
                //        ExpirationDate = (DateTime)medExpirationDatePicker.SelectedDate
            };
            MedicalBillsDTO elem = _medicalBillsService.GetAll().Last();

            dTO.Id               = elem.MedicalBillsType.Id;
            dTO.Type             = medTypeTextBox.Text;
            med.MedicalBillsType = dTO;
            medicalBills.Add(med);
            _medicalBillsService.Add(med);
            medicalBills[medicalBills.Count - 1].Id = elem.Id;
            medicalBillsDataGrid.Items.Refresh();
        }
Exemple #6
0
 private void medUpdateButton_Click(object sender, RoutedEventArgs e)
 {
     if (medicalBillsDataGrid.SelectedItem != null)
     {
         MedicalBillsTypeDTO dTO      = new MedicalBillsTypeDTO();
         MedicalBillsDTO     selected = (MedicalBillsDTO)medicalBillsDataGrid.SelectedItem;
         MedicalBillsDTO     med      = new MedicalBillsDTO
         {
             //Name = medNameTextBox.Text,
             //Quantity = int.Parse(medQuantityTextBox.Text),
             //ManufactureId = int.Parse(medManufacturerTextBox.Text),
             //DateOfManufacture = (DateTime)medDateOfManufacturePicker.SelectedDate,
             //ExpirationDate = (DateTime)medExpirationDatePicker.SelectedDate
         };
         MedicalBillsDTO elem = _medicalBillsService.GetAll().Last();
         dTO.Id               = elem.MedicalBillsType.Id;
         dTO.Type             = medTypeTextBox.Text;
         med.MedicalBillsType = dTO;
         med.Id               = medicalBills[medicalBills.IndexOf(selected)].Id;
         medicalBills[medicalBills.IndexOf(selected)] = med;
         _medicalBillsService.Update(med);
         medicalBillsDataGrid.Items.Refresh();
     }
 }
 public void Update(MedicalBillsDTO entity)
 {
     _repository.Update(Mapper.FromDTO(entity));
 }
 public void Remove(MedicalBillsDTO entity)
 {
     _repository.Remove(Mapper.FromDTO(entity));
 }
 public void Add(MedicalBillsDTO entity)
 {
     _repository.Add(Mapper.FromDTO(entity));
 }
Exemple #10
0
        public IActionResult Delete(int id)
        {
            MedicalBillsDTO med = _medicalBillsService.GetAll().FirstOrDefault(u => u.Id == id);

            return(View(med));
        }