public void UpdateBoardingLodging([FromBody] BoardingLodgingViewModel boardingLodgingData) { List <BoardingLodgingItem> boardingLodgingItems = new List <BoardingLodgingItem>(); boardingLodgingItems.AddRange(boardingLodgingData.boardingLodgingItems); List <BoardingLodgingInfo> boardingLodgingDataList = (_unitofWork.BoardingLodgingRepository.GetBoardingLodgingForRequest(boardingLodgingItems.First().ReimbursementInfoId)); foreach (var item in boardingLodgingItems) { var refItem = boardingLodgingDataList.FirstOrDefault(i => i.ReimbursementInfoId == item.ReimbursementInfoId); if (refItem != null) { refItem.PlaceofStay = item.PlaceofStay; refItem.FromDate = item.FromDate; refItem.ToDate = item.ToDate; refItem.Currency = item.Currency; refItem.AmountSpent = item.AmountSpent; refItem.Eligibility = item.Eligibility; refItem.Remarks = item.Remarks; } } _unitofWork.Complete(); }
public void AddBoardingLodging([FromBody] BoardingLodgingViewModel boardingLodgingViewModel) { List <BoardingLodgingInfo> _boardingLodgingItems = _mapper.Map <List <BoardingLodgingItem>, List <BoardingLodgingInfo> >(boardingLodgingViewModel.boardingLodgingItems); _unitofWork.BoardingLodgingRepository.AddBoardingLodging(_boardingLodgingItems); _unitofWork.Complete(); }
public BoardingLodgingViewModel GetHotelsForRequest(int id) { BoardingLodgingViewModel boardingLodgingOptions = new BoardingLodgingViewModel(); boardingLodgingOptions.boardingLodgingItems = _mapper.Map <List <BoardingLodgingInfo>, List <BoardingLodgingItem> >(_unitofWork.BoardingLodgingRepository.GetBoardingLodgingForRequest(id)); return(boardingLodgingOptions); }