public ActionResult AssociateAdministrativeContact(AssociateAdministrativeContactViewModel model) { if (!this.ModelState.IsValid) { return(View(model)); } WorkerServices.AssociateAdministrativeContact(model); return(RedirectToRoute("registry", new { })); }
public void AssociateAdministrativeContact(AssociateAdministrativeContactViewModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var cmd = new AssociateAdministrativeContactToCompanyCommand(model.CompanyId, model.AdministrativeContact.OriginalId); Bus.Send(cmd); }
public AssociateAdministrativeContactViewModel GetAssociateAdministrativeContactViewModel(Guid companyId) { var company = Repository.GetById <Company>(companyId); var model = new AssociateAdministrativeContactViewModel() { CompanyId = company.Id, CompanyName = company.CompanyName }; if (company.AdministrativeContactId.HasValue) { model.AdministrativeContact = Database.Parties.OfType <Merp.Registry.QueryStack.Model.Person>() .Where(p => p.OriginalId == company.AdministrativeContactId.Value) .Select(p => new PersonInfo { Id = p.Id, OriginalId = p.OriginalId, Name = p.DisplayName }) .Single(); } return(model); }