public void run(RegisterNewCompany item) { if (company_has_already_been_registered(item)) notification.notify(create_error_message_from(item)); else factory.create().change_name_to(item.company_name); }
public AddCompanyView() { InitializeComponent(); titled("Add A Company") .icon(ApplicationIcons.AddCompany); dto = new RegisterNewCompany(); listView1.View = View.LargeIcon; listView1.LargeImageList = new ImageList(); ApplicationIcons.all().each(x => listView1.LargeImageList.Images.Add(x.name_of_the_icon, x)); listView1.Columns.Add("Name"); ux_submit_button.Click += (x, y) => submit_button(y); ux_cancel_button.Click += (x, y) => Close(); }
string create_error_message_from(RegisterNewCompany dto) { return "A Company named {0}, has already been submitted!".formatted_using(dto.company_name); }
bool company_has_already_been_registered(RegisterNewCompany dto) { return companies.all().Count(x => x.name.is_equal_to_ignoring_case(dto.company_name)) > 0; }