Пример #1
0
        public void Validate(CreateNormalJobOfferViewModel model, Entity entity)
        {
            var company   = companyRepository.GetById(model.CompanyID);
            var wallet    = company.Entity.Wallet;
            var policy    = company.Region.Country.CountryPolicy;
            var countryID = company.Region.CountryID.Value;
            var currency  = Persistent.Countries.GetCountryCurrency(countryID);

            if (model.PostOfferOnJobMarket && !wallet.HaveMoney(model.JobMarketFee.CurrencyID, (double)model.JobMarketFee.Quantity * model.Amount))
            {
                AddError("Not enough money", () => model.JobMarketFee);
            }

            if (jobOfferService.IsCompliantWithMinimalWage((decimal)(model.Salary ?? 0), countryID) == false)
            {
                AddError($"Salary is lower than actual minimal wage! ({policy.MinimalWage} {currency.Symbol})");
            }
        }