async Task <int> ISecurityService.AddDelegation(SecurityEmployeeDelegationViewModel model) { if (!model.ParentUpn.HasValue) { model.ParentUpn = await _identityService.GetUserUpn(); } var dbModel = await _unitOfWork.SecurityEmployeeDelegationRepository.AddAsync(_mapper.Map <SecurityEmployeeDelegationViewModel, SecurityEmployeeDelegation>(model)); return(dbModel.Id); }
public async Task <IActionResult> AddDelegation(SecurityEmployeeDelegationViewModel model) { if (!ModelState.IsValid) { return(View("ManageDelegates", model)); } await _cachedSecurityService.AddDelegation(model); return(RedirectToAction(nameof(ManageDelegates))); }
async Task ICachedSecurityService.AddDelegation(SecurityEmployeeDelegationViewModel model) { await _securityService.AddDelegation(model); await _this.RefreshDelegations(model.ParentUpn.Value, model.DelegateUpn.Value); }