示例#1
0
        /// <summary>
        /// Updates the round.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <exception cref="Exception">Round id not found</exception>
        public async Task <Round> UpdateRound(Guid id, RoundUpdateModel model)
        {
            var result = _roundRepository.GetById(id);

            if (result == null)
            {
                throw new Exception("Round id not found");
            }
            result.MoneyRaised    = model.MoneyRaised;
            result.Name           = model.Name;
            result.RoundDate      = model.RoundDate;
            result.ShareIncreased = model.ShareIncreased;
            _roundRepository.Update(result);
            await _unitOfWork.CommitAsync();

            return(result);
        }
 public async Task <Round> UpdateRound([FromRoute] Guid id, [FromBody] RoundUpdateModel model)
 {
     Response.StatusCode = (int)HttpStatusCode.OK;
     return(await _roundService.UpdateRound(id, model));
 }
示例#3
0
 public async Task Update(RoundUpdateModel model)
 {
     await _gameRoundService.Update(model.id, model.Name, model.Duration);
 }