public void SetInsuranceHolder(SetInsuranceClientData data) { var companyAcc = _rightsManager.CheckForAccessOverSlave(data.Company, AccountAccessRoles.Withdraw); var userAccount = UserContext.Accounts.GetOrFail(data.Holder, data.Password); Try.Condition(_associations.ContainsKey(companyAcc.Login), $"{companyAcc.Login} не выпускает страховки"); var t = _associations[companyAcc.Login]; var level = data.Level ?? 0; //t.SetLevel() Try.Condition(CheckInsuranceLevel(level, t), $"Неверный уровень страховки {level}"); SetInsuranceHolder_Checked(userAccount, level, t); }
public IHttpActionResult ChangeInsuranceHolder(SetInsuranceClientData data) { UserContext.Insurances.SetInsuranceHolder(data); return(Ok()); }