//atrod polisi, nomaina statusu uz nopirkts public void BuyInsurance(string policyId) { PolicyRepository policyRepository = new PolicyRepository(); var policy = policyRepository.GetPolicyById(policyId); policy.Statuss = Statuss.Active; policyRepository.SavePolicy(policy); }
public Policy BuyInsurance(Client client, Product productId) { ProductRepository productRepository = new ProductRepository(); var product = productRepository.GetProductById(productId.ProductId); //Izveidot Polices repozitoriju un izmantot metodi //Create a policy PolicyRepository policyRepository = new PolicyRepository(); var policyNumber = policyRepository.CreateNewPolicy(product, client); // var obj = myList.FirstOrDefault(x => x.MyProperty == myValue); // if (obj != null) obj.OtherProperty = newValue; // http://stackoverflow.com/questions/7190016/how-to-update-an-object-in-a-list-in-c-sharp Policy policy = policyRepository.UpdatePolicyState(policyNumber); policyRepository.SavePolicy(policy); return(policy); // policyRepository.UpdatePolicyState(policyNumber); }