예제 #1
0
		public void SaveInstruction(InstructionItemViewModel viewModel, string clientCompanyId)
		{
			var company = _clientCompanyManagement.FindById(clientCompanyId);
			if (company == null)
				throw new ArgumentNullException("company not found");
			_clientCompanyManagement.SaveInstruction(company, viewModel);
		}
예제 #2
0
		public void SaveInstruction(ClientCompany company, InstructionItemViewModel viewModel)
		{
			if (company == null)
				throw new ArgumentNullException("company");

			if (viewModel == null)
				throw new ArgumentNullException("InstructionViewModel");

			if (company.CompanyInstructions == null)
				company.CompanyInstructions = new List<ClientCompanyInstruction>();

			var instruction = company.CompanyInstructions.SingleOrDefault(i => i.Id.ToString().Equals(viewModel.Id));

			if (instruction == null)
			{
				instruction = new ClientCompanyInstruction();
				company.CompanyInstructions.Add(instruction);
			}
			instruction.Text = viewModel.Text;

		}