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(); } }
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()); } }
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()); }
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()); } }
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(); }
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)); }
public IActionResult Delete(int id) { MedicalBillsDTO med = _medicalBillsService.GetAll().FirstOrDefault(u => u.Id == id); return(View(med)); }