public async Task AddDistinctionAsync(DistinctionDTO distinctionDTO, ClaimsPrincipal user) { CheckIfAdmin(user); var distinction = _mapper.Map <DistinctionDTO, Distinction>(distinctionDTO); await _repoWrapper.Distinction.CreateAsync(distinction); await _repoWrapper.SaveAsync(); }
public async Task AddDistinctionAsync(DistinctionDTO distinctionDTO, User user) { await CheckIfAdminAsync(user); var distinction = _mapper.Map <DistinctionDTO, Distinction>(distinctionDTO); await _repoWrapper.Distinction.CreateAsync(distinction); await _repoWrapper.SaveAsync(); }
public async Task ChangeDistinctionAsync(DistinctionDTO distinctionDTO, ClaimsPrincipal user) { CheckIfAdmin(user); var distinction = await _repoWrapper.Distinction.GetFirstAsync(x => x.Id == distinctionDTO.Id); distinction.Name = distinctionDTO.Name; _repoWrapper.Distinction.Update(distinction); await _repoWrapper.SaveAsync(); }
public async Task AddDistinctionAsync(DistinctionDTO distinctionDTO, ClaimsPrincipal user) { if (!user.IsInRole("Admin")) { throw new UnauthorizedAccessException(); } var distinction = _mapper.Map <DistinctionDTO, Distinction>(distinctionDTO); await _repoWrapper.Distinction.CreateAsync(distinction); await _repoWrapper.SaveAsync(); }
public async Task ChangeDistinctionAsync(DistinctionDTO distinctionDTO, ClaimsPrincipal user) { if (!user.IsInRole("Admin")) { throw new UnauthorizedAccessException(); } var distinction = await _repoWrapper.Distinction.GetFirstAsync(x => x.Id == distinctionDTO.Id); distinction.Name = distinctionDTO.Name; _repoWrapper.Distinction.Update(distinction); await _repoWrapper.SaveAsync(); }