示例#1
0
        public IActionResult Details(Guid Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }

            var userProductViewModel = _contractService.GetUserProductValue(Id);

            var model = new DetailsContractViewModel
            {
                StatusMessage = StatusMessage,

                PdtPercent        = _userContractRepository.EntityItems.Where(x => x.ContractId == Id).Sum(x => x.Ratio) * 100,
                ContractViewModel = _contractRepository.EntityItems
                                    .Join(_userRepository.EntityItems, p => p.UserId, q => q.Id, (p, q) => _mapper.Map <ContractViewModel>(p))
                                    .Where(p => p.Id == Id).FirstOrDefault(),
                UserProductValueViewModels = userProductViewModel,
            };

            return(View(model));
        }
示例#2
0
        // GET: Contracts/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DetailsContractViewModel model = new DetailsContractViewModel();

            model.Contract = await _context.Contracts
                             .Include(c => c.ContractFiles)
                             .Include(c => c.ContractProperties).ThenInclude(c => c.Property)
                             .Include(c => c.Acts).ThenInclude(a => a.ActFiles)
                             .Include(c => c.Supplementaries).ThenInclude(s => s.SupplementaryFiles)
                             .SingleOrDefaultAsync(m => m.Id == id);

            if (model.Contract == null)
            {
                return(NotFound());
            }
            model.Counterparties = _context.ContractCounterparties.Include(s => s.Counterparty).Where(c => c.ContractId == id).Select(s => s.Counterparty).ToList();

            return(View(model));
        }