public async Task <bool> IncreaseOptionPool([FromBody] CompanyIncreaseOptionPoolMode model)
        {
            var result = await _companyService.IncreaseOptionPool(model);

            Response.StatusCode = (int)HttpStatusCode.OK;
            return(result);
        }
Example #2
0
        /// <summary>
        /// Increases the option pool.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <exception cref="EntityNotFoundException">Company id {model.CompanyId} not found</exception>
        public async Task <bool> IncreaseOptionPool(CompanyIncreaseOptionPoolMode model)
        {
            var company = _companyRepository.GetById(model.CompanyId);

            if (company == null)
            {
                throw new EntityNotFoundException($"Company id {model.CompanyId} not found");
            }
            company.OptionPollAmount += model.SharesAmount;
            company.TotalShares      += model.SharesAmount;

            _companyRepository.Update(company);
            await _unitOfWork.CommitAsync();

            return(true);
        }