public void DeleteSnapshot(int snapshotId) { var snapshot = GetSnapshotById(snapshotId); if (snapshot.PhotoId.HasValue) { _photoManager.DeletePhoto(snapshot.PhotoId.Value); } _aquariumDao.DeleteSnapshot(snapshot.Id); }
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()); }