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(); }
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(); }