Exemplo n.º 1
0
        public async Task <AddDelegatedAuthorityResponse> AddDelegatedAuthority(AddDelegateAuthorityRequest request)
        {
            var companyEmploee = employee.All()
                                 .FirstOrDefault(x => x.ID == request.AuthorityEmployeeID);

            if (companyEmploee == null)
            {
                return(new AddDelegatedAuthorityResponse {
                    Message = "No employee found", Success = false
                });
            }
            var companyEmployee = companyEmploee.ID;

            var delegateToAdd = new DelegateAuthority {
                CompanyEmployeeID = companyEmployee, EmployeeID = request.EmployeeID
            };

            delegateAuthority.Add(delegateToAdd);

            delegateAuthority.SaveChanges();

            return(new AddDelegatedAuthorityResponse {
                Success = true
            });
        }
Exemplo n.º 2
0
 public async Task <AddDelegatedAuthorityResponse> AddAuthority([FromBody] AddDelegateAuthorityRequest request)
 {
     return(await delegateAuthirityService.AddDelegatedAuthority(request));
 }