コード例 #1
0
        public async Task <ActionResult> PutUserLimits(int id, UserLimitsToApply limits)
        {
            System.Diagnostics.Debug.WriteLine($"PutUserLimits: UserId: {id}, LimitId: {limits.LimitId}");
            await _userService.ChangeLimitsForUserAsync(id, limits);

            return(NoContent());
        }
コード例 #2
0
        public async Task <User> ChangeLimitsForUserAsync(int userId, UserLimitsToApply limitsToApply)
        {
            if (limitsToApply.LimitId.HasValue)
            {
                await _limitService.GetLimitAsync(limitsToApply.LimitId.Value);
            }

            var user = await GetUserAsync(userId);

            user.LimitId = limitsToApply.LimitId;
            _schedulearnContext.Update(user);
            await _schedulearnContext.SaveChangesAsync();

            return(user);
        }