public ActionResult Create(MedRecordViewModel model) { try { _medRecordRepository.Add(_mapper.Map <MedRecord>(model)); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Index))); } }
public ActionResult Edit(int id, MedRecordViewModel model) { try { model.MedRecordId = id; _medRecordRepository.Update(_mapper.Map <MedRecord>(model)); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Index))); } }
public MainWindow(MainViewModel vm) { this.DataContext = vm; InitializeComponent(); Employee = vm.currentemployee; if (Employee.Post.Name == "Врач") { diagnosis.Visibility = Visibility.Collapsed; employees.Visibility = Visibility.Collapsed; EditItem.Visibility = Visibility.Collapsed; medicament.Visibility = Visibility.Collapsed; medrecords.IsSelected = true; MedRecordViewModel medvm = new MedRecordViewModel(Employee); UCMedRecord.DataContext = medvm; } else if (Employee.Post.Name == "Сотрудник регистратуры") { diagnosis.Visibility = Visibility.Collapsed; employees.Visibility = Visibility.Collapsed; EditItem.Visibility = Visibility.Collapsed; medicament.Visibility = Visibility.Collapsed; medrecords.IsSelected = true; MedRecordViewModel medvm = new MedRecordViewModel(Employee); UCMedRecord.DataContext = medvm; } if (Employee.Post.Name == "Администратор") { EditItem.Visibility = Visibility.Collapsed; MedRecordViewModel medvm = new MedRecordViewModel(Employee); UCMedRecord.DataContext = medvm; DiagnosisViewModel diavm = new DiagnosisViewModel(); UCDiagnosis.DataContext = diavm; MedicamentViewModel medivm = new MedicamentViewModel(); UCMedicament.DataContext = medivm; EmployeeViewModel empvm = new EmployeeViewModel(); UCEmployee.DataContext = empvm; } }