Exemplo n.º 1
0
        public async Task AddUserPrecautionAsync(UserPrecautionDTO userPrecautionDTO, User user)
        {
            await CheckIfAdminAsync(user);

            var userPrecaution = new UserPrecaution()
            {
                UserId       = userPrecautionDTO.UserId,
                PrecautionId = userPrecautionDTO.PrecautionId,
                Date         = userPrecautionDTO.Date,
                Reason       = userPrecautionDTO.Reason,
                Reporter     = userPrecautionDTO.Reporter,
                Number       = userPrecautionDTO.Number,
                Status       = userPrecautionDTO.Status
            };
            await _repoWrapper.UserPrecaution.CreateAsync(userPrecaution);

            await _repoWrapper.SaveAsync();
        }
Exemplo n.º 2
0
        public async Task ChangeUserPrecautionAsync(UserPrecautionDTO userPrecautionDTO, User user)
        {
            await CheckIfAdminAsync(user);

            var userPrecaution = new UserPrecaution()
            {
                Id           = userPrecautionDTO.Id,
                UserId       = userPrecautionDTO.UserId,
                PrecautionId = userPrecautionDTO.PrecautionId,
                Date         = userPrecautionDTO.Date,
                Reason       = userPrecautionDTO.Reason,
                Reporter     = userPrecautionDTO.Reporter,
                Number       = userPrecautionDTO.Number,
                Status       = userPrecautionDTO.Status,
                EndDate      = userPrecautionDTO.EndDate,
                IsActive     = userPrecautionDTO.IsActive
            };

            _repoWrapper.UserPrecaution.Update(userPrecaution);
            await _repoWrapper.SaveAsync();
        }