コード例 #1
0
        public DeptorsReadersModel Map(ReaderHistory o)
        {
            if (o == null)
            {
                return(null);
            }
            DeptorsReadersModel    deptorsReadersBusiness = new DeptorsReadersModel();
            ReaderMapper           readerMapper           = new ReaderMapper();
            InventoryMapper        inventoryMapper        = new InventoryMapper();
            ReaderBusinessModel    readerBusinessModel    = readerMapper.Map(o.Reader);
            InventoryBusinessModel invertoryBusinessModel = inventoryMapper.Map(o.Inventory);

            deptorsReadersBusiness.readerId  = readerBusinessModel.ReaderId;
            deptorsReadersBusiness.FirstName = readerBusinessModel.FirstName;
            deptorsReadersBusiness.LastName  = readerBusinessModel.LastName;
            deptorsReadersBusiness.Address   = readerBusinessModel.Address;
            deptorsReadersBusiness.Phone     = readerBusinessModel.Phone;
            if (o.Inventory != null)
            {
                deptorsReadersBusiness.ItemName = invertoryBusinessModel.Item.Name;
            }
            deptorsReadersBusiness.StartDate  = o.StartDate;
            deptorsReadersBusiness.FinishDate = o.FinishDate;

            return(deptorsReadersBusiness);
        }
コード例 #2
0
ファイル: TagScoreMapper.cs プロジェクト: SKDon/SchoolLibrary
        public TagScore Map(TagScoreBusinessModel source)
        {
            TagScore destination = new TagScore();

            if (source.Item is BookBusinessModel)
            {
                BookWithoutTagsMapper bookMapper = new BookWithoutTagsMapper();
                destination.Item = bookMapper.Map(source.Item as BookBusinessModel);
            }

            if (source.Item is DiskBusinessModel)
            {
                DiskMapper diskMapper = new DiskMapper();
                destination.Item = diskMapper.Map(source.Item as DiskBusinessModel);
            }

            if (source.Item is MagazineBusinessModel)
            {
                MagazineMapper magazineMapper = new MagazineMapper();
                destination.Item = magazineMapper.Map(source.Item as MagazineBusinessModel);
            }

            ReaderMapper readerMapper = new ReaderMapper();

            destination.Reader = readerMapper.Map(source.Reader);

            destination.Score = source.Score;

            return(destination);
        }
コード例 #3
0
        public UserProfile Map(UserProfileBusinessModel source)
        {
            ReaderMapper readerMapper = new ReaderMapper();

            if (source == null)
            {
                return(null);
            }

            UserProfile userProfile = new UserProfile
            {
                UserId   = source.UserId,
                UserName = source.UserName,
                Email    = source.Email
            };

            return(userProfile);
        }
コード例 #4
0
        public HistoryBusinessModelForGrid Map(ReaderHistory o)
        {
            if (o == null)
            {
                return(null);
            }
            HistoryBusinessModelForGrid readerHistoryBusiness = new HistoryBusinessModelForGrid();
            ReaderMapper           readerMapper           = new ReaderMapper();
            InventoryMapper        inventoryMapper        = new InventoryMapper();
            ReaderBusinessModel    readerBusinessModel    = readerMapper.Map(o.Reader);
            InventoryBusinessModel invertoryBusinessModel = inventoryMapper.Map(o.Inventory);

            readerHistoryBusiness.ReaderName = readerBusinessModel.FirstName;
            readerHistoryBusiness.ItemName   = invertoryBusinessModel.Item.Name;
            readerHistoryBusiness.StartDate  = o.StartDate;
            readerHistoryBusiness.FinishDate = o.FinishDate;

            return(readerHistoryBusiness);
        }
コード例 #5
0
        public ReaderHistory Map(ReaderHistoryBusinessModel o)
        {
            if (o == null)
            {
                return(null);
            }
            ReaderHistory   readerHistory   = new ReaderHistory();
            ReaderMapper    readerMapper    = new ReaderMapper();
            InventoryMapper inventoryMapper = new InventoryMapper();
            Reader          reader          = readerMapper.Map(o.ReaderBusiness);
            Inventory       invertory       = inventoryMapper.Map(o.InventoryBusiness);

            readerHistory.ReaderHistoryId = o.Id;
            readerHistory.StartDate       = o.StartDate;
            readerHistory.ReturnDate      = o.ReturnDate;
            readerHistory.FinishDate      = o.FinishDate;
            readerHistory.Reader          = reader;
            readerHistory.Inventory       = invertory;

            return(readerHistory);
        }
コード例 #6
0
        public ReaderHistoryBusinessModel Map(ReaderHistory o)
        {
            if (o == null)
            {
                return(null);
            }
            ReaderHistoryBusinessModel readerHistoryBusiness = new ReaderHistoryBusinessModel();
            ReaderMapper           readerMapper           = new ReaderMapper();
            InventoryMapper        inventoryMapper        = new InventoryMapper();
            ReaderBusinessModel    readerBusinessModel    = readerMapper.Map(o.Reader);
            InventoryBusinessModel invertoryBusinessModel = inventoryMapper.Map(o.Inventory);

            readerHistoryBusiness.Id                = o.ReaderHistoryId;
            readerHistoryBusiness.StartDate         = o.StartDate;
            readerHistoryBusiness.ReturnDate        = o.ReturnDate;
            readerHistoryBusiness.FinishDate        = o.FinishDate;
            readerHistoryBusiness.ReaderBusiness    = readerBusinessModel;
            readerHistoryBusiness.InventoryBusiness = invertoryBusinessModel;

            return(readerHistoryBusiness);
        }