コード例 #1
0
        /// <summary>
        /// Updates the round investor.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <exception cref="Exception">Round Invester id not found</exception>
        public async Task <RoundInvestor> UpdateRoundInvestor(Guid id, RoundInvesterUpdateModel model)
        {
            var result = _roundInvestorRepository.GetById(id);

            if (result == null)
            {
                throw new Exception("Round Invester id not found");
            }
            result.InvestedValue           = model.InvestedValue;
            result.InvestorName            = model.InvestorName;
            result.PhotoUrl                = model.PhotoUrl;
            result.ShareAmount             = model.ShareAmount;
            result.SharesHoldingPercentage = model.SharesHoldingPercentage;
            _roundInvestorRepository.Update(result);
            await _unitOfWork.CommitAsync();

            return(result);
        }
 public async Task <RoundInvestor> UpdateRoundInvester([FromRoute] Guid id, [FromBody] RoundInvesterUpdateModel model)
 {
     Response.StatusCode = (int)HttpStatusCode.OK;
     return(await _roundInvestorService.UpdateRoundInvestor(id, model));
 }