コード例 #1
0
 public void UpdateTrip(Trip trip)
 {
     TripRepository.Update(trip);
     SaveTrip();
 }
コード例 #2
0
 public void CreateTrip(Trip trip)
 {
     TripRepository.Add(trip);
     this.SaveTrip();
 }
コード例 #3
0
 public void DeleteTrip(Trip trip)
 {
     TripRepository.Delete(trip);
     SaveTrip();
 }
コード例 #4
0
        public ActionResult Create(CreateViewModel createViewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(createViewModel);
            }

            var trip = new Trip()
            {
                Name = createViewModel.Name,
                Description = createViewModel.Description,
                TripCode = createViewModel.TripCode,
                NumberOfDay = createViewModel.NumberOfDay != null ? createViewModel.NumberOfDay.Value : 0
            };
            TripService.CreateTrip(trip);
            TempData["TripId"] = trip.TripId;
            TempData["TripName"] = trip.Name;
            TempData["Message"] = TripsMessage.CreateSuccess;
            return RedirectToAction("index", "trips");
        }