public IActionResult DeleteEnergyExpenditure(Guid id) { var expenditure = activityRepository.GetEnergyExpenditure(id); if (expenditure == null) { return(NotFound()); } if (expenditure.UserId != CurrentUserId) { return(Unauthorized()); } activityRepository.DeleteEnergyExpenditure(expenditure); return(Ok()); }