Exemplo n.º 1
0
        public async Task <ActionResult> Detail(string code)
        {
            GetDocumentByCodeDto getDocumentByCodeDto = await Mediator.Send(new GetDocumentByCodeQuery
            {
                Code = code
            });

            string department = User.Identity.GetDepartment();

            if (getDocumentByCodeDto.ScopeOfDeloyment.Contains(department))
            {
                return(View(getDocumentByCodeDto));
            }

            string userName = User.Identity.GetUserName();

            if (getDocumentByCodeDto.Auditor.Equals(userName))
            {
                return(View(getDocumentByCodeDto));
            }

            if (getDocumentByCodeDto.Drafter.Equals(userName))
            {
                return(View(getDocumentByCodeDto));
            }

            if (getDocumentByCodeDto.Approver.Equals(userName))
            {
                return(View(getDocumentByCodeDto));
            }

            return(RedirectToAction("List"));
        }
        public async Task <ActionResult> Detail(string code)
        {
            GetDocumentByCodeDto getDocumentByCodeDto = await Mediator.Send(new GetDocumentByCodeQuery
            {
                Code = code
            });

            return(View(getDocumentByCodeDto));
        }