Пример #1
0
        public ActionResult <int> DeletePhoto(int journeyId, int id)
        {
            var userid = GetUserId(User);

            if (!_overviewRepository.IsUsersJourney(userid, journeyId))
            {
                return(StatusCode(403, "Journey doesn't belong to the user"));
            }

            var deletedId = _overviewRepository.DeletePhoto(id);

            if (!_overviewRepository.JourneyHasPhotos(journeyId))
            {
                _overviewRepository.DeleteJourney(journeyId);
            }

            return(Ok(deletedId));
        }
Пример #2
0
 public void TestDeletePhotoNotFound()
 {
     Assert.AreEqual(-1, _repository.DeletePhoto(100));
 }