コード例 #1
0
        public async Task <IResult> UpdateAsync(ProgressModel model)
        {
            var validation = await new UpdateProgressModelValidator().ValidateAsync(model);

            if (validation.Failed)
            {
                return(Result.Fail(validation.Message));
            }

            var Progress = await _ProgressRepository.GetAsync(model.Id);

            if (Progress == default)
            {
                return(Result.Success());
            }

            Progress.ChangeWeight(model.Weight);

            await _ProgressRepository.UpdateWeightAsync(Progress);

            await _unitOfWork.SaveChangesAsync();

            return(Result.Success());
        }