public async Task <ResponseModel <ShareAccount> > UpdateInfo([FromBody] SharesAccountEditModel model)
        {
            var result = await _sharesAccountService.UpdateShareAccount(model);

            Response.StatusCode = (int)HttpStatusCode.OK;
            return(new ResponseBuilder <ShareAccount>()
                   .Success()
                   .Data(result)
                   .build());
        }
コード例 #2
0
        /// <summary>
        /// Updates the share account.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <exception cref="Exception">SharesAccount not found</exception>
        public async Task <ShareAccount> UpdateShareAccount(SharesAccountEditModel model)
        {
            var query = _shareAccountRepository.GetById(model.Id);

            if (query == null)
            {
                throw new Exception("SharesAccount not found");
            }
            query.ShareAmount   = model.ShareAmount;
            query.ShareTypeCode = model.ShareTypeCode;
            _shareAccountRepository.Update(query);
            await _unitOfWork.CommitAsync();

            return(query);
        }