コード例 #1
0
        public void DeleteSnapshot(int snapshotId)
        {
            var snapshot = GetSnapshotById(snapshotId);

            if (snapshot.PhotoId.HasValue)
            {
                _photoManager.DeletePhoto(snapshot.PhotoId.Value);
            }
            _aquariumDao.DeleteSnapshot(snapshot.Id);
        }
コード例 #2
0
        public async Task <IActionResult> DeletePhoto(int userId, int id)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var result = await _photoManager.DeletePhoto(userId, id);

            if (!result.isValid)
            {
                return(BadRequest(result.Message));
            }

            return(Ok());
        }