Esempio n. 1
0
        public ActionResult OperatorApprove(OperatorApproveCommand command)
        {
            var employee = GetEmployee();

            command.EmployeeId = employee.Id;
            _employeeService.OperatorApproveCommand(command);
            var request = GetRequest(command);

            _creditRequestService.UnassignEmployee(request);
            return(RedirectToAction("Operator"));
        }
Esempio n. 2
0
        public CommandResult OperatorApproveCommand(OperatorApproveCommand command)
        {
            var rightsRes   = CheckEmployeeRights(command.EmployeeId, EmployeeRights.Operator);
            var employeeRes = GetEmployee(command.EmployeeId);
            var requestRes  = GetCreditRequest(command.CreditRequestId);
            var res         = CheckQueries(rightsRes, employeeRes, requestRes);

            if (res.IsFailed)
            {
                return(new CommandResult(command, false).From(res));
            }
            var request = requestRes.Value;

            request.IsOperatorApproved = command.Approved;
            request.OperatorComments   = command.Comments;
            request.OperatorApproved   = employeeRes.Value;
            return(UpdateCreditRequest(command, request));
        }