コード例 #1
0
        public DetailsCommand GetOne(int Id)
        {
            DetailsCommand dc  = new DetailsCommand();
            Command        cmd = _commandRepo.GetOne(Id).CommandDTOToCommanDAO();

            dc.DateOfCommand = cmd.DateOfCommand;
            dc.Address       = _addressRepo.GetAddressByClientAddress(cmd.IdAddress).AddressDTOToAddressDAO();
            dc.Address.City  = _cityRepo.GetOne(dc.Address.City.Id).CityDTOToCityDAO();
            dc.Client        = _clientRepo.GetOne(cmd.IdClient).ClientDTOToClientDAO();
            dc.Commandwine   = _commandRepo.GetAllCommandWineByCommandId(Id).Select(x => x.CommandWineDAOToCommandWineDTO()).ToList();
            foreach (CommandWine cw in dc.Commandwine)
            {
                cw.wineName  = _wineRepo.GetOne(cw.IdWine).WineName;
                cw.winePrice = _wineRepo.GetWinePrice(cw.IdWine).FirstOrDefault().PriceWine;
            }
            return(dc);
        }