Example #1
0
        public IHttpActionResult GetTrip(int id)
        {
            TripService tripService = CreateTripService();
            var         trip        = tripService.GetTripById(id);

            return(Ok(trip));
        }
Example #2
0
        public Trip GetTripById(string id)
        {
            Guid guid = new Guid();

            Guid.TryParse(id, out guid);
            return(TripService.GetTripById(guid));
        }
Example #3
0
        public IHttpActionResult Get(int id)
        {
            var tripService = new TripService(Guid.Parse(User.Identity.GetUserId()));
            var note        = tripService.GetTripById(id);

            if (note == null)
            {
                return(NotFound());
            }
            return(Ok(note));
        }
Example #4
0
        public void Test_GetTripById_Success()
        {
            // Arrange
            var tripId = "123";

            // Act
            _tripService.GetTripById(tripId);

            // Assert
            _mockTripRepository.Verify(m => m.GetTripById(tripId), Times.Once());
        }
Example #5
0
        public IHttpActionResult Put(TripEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var noteService = new TripService(Guid.Parse(User.Identity.GetUserId()));
            var temp        = noteService.GetTripById(model.TripID);

            if (temp == null)
            {
                return(NotFound());
            }

            return(Ok(noteService.EditTrip(model)));
        }
Example #6
0
        public IHttpActionResult Delete(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var noteService = new TripService(Guid.Parse(User.Identity.GetUserId()));
            var temp        = noteService.GetTripById(id);

            if (temp == null)
            {
                return(NotFound());
            }

            return(Ok(noteService.DeleteTrip(id)));
        }
Example #7
0
 public TripDTO Get(int id)
 {
     return(_service.GetTripById(id));
 }