Esempio n. 1
0
        public TravelDetailModel AddTravelDetail(TravelDetailModel travelDetailData)
        {
            TravelDetail travelDetail = AutoMapper.Mapper.Map <TravelDetailModel, TravelDetail>(travelDetailData);

            travelDetail.TravelDetailTrails.Add(new TravelDetailTrail()
            {
                TravelId    = travelDetail.Id,
                StatusId    = 1,
                ProcessedBy = travelDetail.UserID,
                Date        = travelDetail.Summary_SubmittedDate,
            });

            //foreach (var travelPlace in travelDetailData.TravelPlaceDetail)
            //{
            //    travelDetail.TravelPlaceDetails.Add(new Database.DAL.TravelPlaceDetail()
            //    {
            //        Id = travelDetail.Id,
            //        StateId = travelDetailData.Detail_ReturningToState,
            //        CityId = travelDetailData.Detail_ReturningToCity,
            //        Type="TravellingFrom"
            //    });
            //}

            TravelDetail traveldata = TravelRepository.AddTravelDetail(travelDetail);

            return(AutoMapper.Mapper.Map <TravelDetail, TravelDetailModel>(traveldata));
        }