public GuarantorEditView(int GuarantorId) { InitializeComponent(); _guarantorEditViewModel = Program.Factory.Resolve <GuarantorEditViewModel>(); _guarantorEditViewModel.AccountsLoaded += _guarantorEditViewModel_AccountsLoaded; _GuarantorEntityValidator = Program.Factory.Resolve <IEntityValidator>(); LoadGuarantor(GuarantorId); TranslateControls(); _isNewGuarantor = false; }
public IActionResult Edit(int id) { var model = _employeeRepository.GetGuarantor(id); GuarantorEditViewModel guarantorEditViewModel = new GuarantorEditViewModel { DocUrl = model.DocUrl, Name = model.Name, StudentId = model.StudentId, Phone = model.Phone, ID = model.ID }; return(View(guarantorEditViewModel)); }
public IActionResult Edit(GuarantorEditViewModel guarantorEditViewModel) { if (ModelState.IsValid) { Guarantor guarantor = _employeeRepository.GetGuarantor(guarantorEditViewModel.ID); guarantor.DocUrl = guarantorEditViewModel.DocUrl; guarantor.StudentId = guarantorEditViewModel.StudentId; guarantor.Phone = guarantorEditViewModel.Phone; guarantor.Name = guarantorEditViewModel.Name; _employeeRepository.UpdateGuarantor(guarantor); return(RedirectToAction("Index")); } return(View()); }
public GuarantorEditView() { InitializeComponent(); _guarantorEditViewModel = Program.Factory.Resolve <GuarantorEditViewModel>(); _guarantorEditViewModel.AccountsLoaded += _guarantorEditViewModel_AccountsLoaded; _GuarantorEntityValidator = Program.Factory.Resolve <IEntityValidator>(); _GuarantorEntityValidator.controlCollection = Controls; _GuarantorEntityValidator.DataEntity = _Guarantor; guarantorBindingSource.DataSource = new OrphanageDataModel.Persons.Guarantor(); _Guarantor = new OrphanageDataModel.Persons.Guarantor(); _isNewGuarantor = true; addressForm1.AddressDataSource = new Address(); nameForm1.NameDataSource = new Name(); EnableDisableControls(false); TranslateControls(); }