Exemplo n.º 1
0
        public bool DeleteEmployee(Employee employeeObj)
        {
            bool EmployeeDeleted = false;

            EmployeeDeleted = Operations.DeleteEmployee(employeeObj);
            return(EmployeeDeleted);
        }
        public IActionResult RemoveEmployee(
            [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "EmployeeFunctionApi/{id:int}")] HttpRequestMessage req, int id, ExecutionContext context)
        {
            /*Validate JWT*/
            if ((SecurityJwt.ValidateTokenWithRoleAsync(req.Headers.Authorization, context.FunctionAppDirectory, "Admin")) == null)
            {
                return(new UnauthorizedResult());
            }
            /*Code*/
            var         result          = db.DeleteEmployee(id);
            EmployeeDto responseMessage = _mapper.Map <Employees, EmployeeDto>(result);

            return(new OkObjectResult(responseMessage));
        }