Beispiel #1
0
 public HistoryTrip InsertHistoryTrip(HistoryTrip historyTrip)
 {
     using (var uow = new  ShipwayUnitOfWork())
     {
         return(uow.HistoryTripRepository.Add(historyTrip));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Method to get HistoryTrip object from trip object.
        /// </summary>
        /// <param name="trip">
        /// Object where the information will be taken from.
        /// </param>
        /// <returns>
        /// Return HistoryTrip object from trip data.
        /// </returns>
        public HistoryTrip ConvertToHistoryTrip(Trip trip)
        {
            var historyTrip = new HistoryTrip
            {
                TripId             = trip.Id,
                Name               = trip.Name,
                StaticImageWay     = trip.StaticImageWay,
                Descriprion        = trip.Descriprion,
                TimeAfterDeparture = trip.TimeAfterDeparture,
                Address            = trip.Address,
                StatusEnum         = trip.StatusEnum,
                UserId             = trip.UserId
            };

            return(historyTrip);
        }
Beispiel #3
0
        public bool UpdateStatusOfExhibition(string exhibitionId, string exhibitionStatus, string address)
        {
            var exhibition         = exhibitionProvider.GetExhibitionById(exhibitionId);
            int exhibitionStatusId = exhibitionStatusProvider.GetIdOfExhibitionStatus(exhibitionStatus);

            exhibition.ExhibitionStatusId = exhibitionStatusId;
            var         exhibitionUpdate = exhibitionProvider.UpdateExhibition(exhibition);
            HistoryTrip historyTrip      = new HistoryTrip();

            historyTrip.ExhibitionId       = exhibitionUpdate.ExhibitionId;
            historyTrip.ExhibitionStatusId = exhibitionUpdate.ExhibitionStatusId;
            historyTrip.CurrentAddress     = address;
            historyTrip.DateTrip           = DateTime.Now;
            var historyNew = historyTripProvider.InsertHistoryTrip(historyTrip);

            if (exhibitionUpdate != null && historyNew != null)
            {
                return(true);
            }
            return(false);
        }
        public ActionResult SaveExhibiton(Exhibition exhibition)
        {
            if (ModelState.IsValid)
            {
                exhibition.CreatedDate   = DateTime.Now;
                exhibition.CreatedUserId = ((User)Session["CurrentUser"]).Id;
                exhibition.ExhibitionId  = GenCodeRandom();
                var exhibitionStatusId = _exhibitionStatusProvider.GetIdOfExhibitionStatus("Mới tạo");
                exhibition.ExhibitionStatusId = exhibitionStatusId;
                _exhibitionProvider.InsertExhibiton(exhibition);

                IHistoryTripProvider historyTripProvider = new HistoryTripProvider();
                var historyTrip = new HistoryTrip();
                historyTrip.ExhibitionId       = exhibition.ExhibitionId;
                historyTrip.DateTrip           = exhibition.CreatedDate;
                historyTrip.ExhibitionStatusId = exhibitionStatusId;
                historyTrip.CurrentAddress     = "";
                historyTripProvider.InsertHistoryTrip(historyTrip);
            }

            return(RedirectToAction("Index", "ExhibitionCustomer"));
        }