Ejemplo n.º 1
0
        public ActionResult NewTravellist(TravelList t)
        {
            TravelList travellist = new TravelList()
            {
                Name      = t.Name,
                Country   = t.Country,
                Street    = t.Street,
                HouseNr   = t.HouseNr,
                DateLeave = t.DateLeave,
                DateBack  = t.DateBack
            };

            _travelRepo.Add(travellist);
            _travelRepo.SaveChanges();
            return(CreatedAtAction(nameof(GetTravelList), new { id = travellist.Id }, travellist));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is used for Create new Travel List
        /// </summary>
        /// <param name="req">req is an object type of TravelList class (request)</param>
        /// <returns>this will return TravelList object of Data class</returns>
        public TravelList CreateTravelList(Mpower.Rail.Model.Request.TravelList req)
        {
            TravelList travellst = new TravelList();

            travellst.listName     = req.listName;
            travellst.description  = req.description;
            travellst.loginAccount = req.loginAccount;
            _travelListRepository.Add(travellst);
            _travelListRepository.Commit();
            foreach (long pass in req.passengerIds)
            {
                _travelpassengerlistRepository
                .Add(new TravelPassengerLists
                {
                    passenger  = pass,
                    travelList = travellst.Id
                });
                _travelpassengerlistRepository.Commit();
            }
            return(travellst);
        }