public async Task <IActionResult> GetCustomerProfile(int id)
        {
            var customer = await customerProfileService.FindAsync(id);

            if (customer == null)
            {
                return(NotFound());
            }

            return(Ok(customer));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SubmitToApprover(int id)
        {
            var request = await bdoFormHeaderService.FindAsync(id);

            bdoFormHeaderService.Update(request, 8);
            var currentMaef = await maefService.FindAsync(id);

            currentMaef.processedBy   = name;
            currentMaef.processedDate = DateTime.Now;
            await maefService.Update(currentMaef);

            var customerProfile = await customerProfileService.FindAsync(id);

            var approvalMatrix = await customerProfileService.FindApproveMatrixAsync(customerProfile.ownership, request.RequestType);

            foreach (var item in approvalMatrix.Items)
            {
                await maefService.InsertRequiredApprovalAsync(new RequiredApproval {
                    approvalCount = item.approvalCount,
                    rank          = item.rank,
                    user          = name,
                    requestId     = id,
                    finalApprover = item.finalApprover,
                });
            }
            await maefService.SaveChangesAsync();

            await bdoFormHeaderService.SaveChangesAsync();

            return(Ok());
        }