コード例 #1
0
 public RetryAction(
     Func <TSource> chooseRandomly,
     UpdateWeight <TSource> updateWeight)
 {
     _chooseRandomly = chooseRandomly;
     _updateWeight   = updateWeight;
 }
コード例 #2
0
        public async Task <IActionResult> UpdateTrainingTemplate([FromBody] UpdateWeight weightModel, string id)
        {
            try
            {
                if (string.IsNullOrEmpty(id) || string.IsNullOrWhiteSpace(id))
                {
                    return(BadRequest());
                }
                var weight = await _context.Weights.FirstOrDefaultAsync(x => x.Id.ToString().Equals(id));

                if (weight == null)
                {
                    return(NotFound());
                }
                weight.FailCount       = weightModel.FailCount;
                weight.IncreaseCount   = weightModel.IncreaseCount;
                weight.LastIncreaseDay = weightModel.LastIncreaseDay;
                weight.SuccessfullDays = weightModel.SuccessfullDays;
                weight.Weight          = weightModel.Weight;
                await _context.SaveChangesAsync();

                return(new NoContentResult());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }