Esempio n. 1
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"));
        }