Exemple #1
0
 public void Delete(int id)
 {
     if (_measureRep.Exists(id))
     {
         _measureRep.Delete(id);
     }
 }
Exemple #2
0
        public async Task <IActionResult> Delete(int aquariumId, int measurementId)
        {
            try
            {
                var measurement = await _repository.Get(measurementId);

                if (measurement == null)
                {
                    return(NotFound());
                }
                if (measurement.UserId != UserId)
                {
                    return(BadRequest("User and Measurement don't match"));
                }
                if (measurement.AquariumId != aquariumId)
                {
                    return(BadRequest("Aquarium and Measurement don't match"));
                }

                await _repository.Delete(measurement.Id);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "An error occured whilst trying to delete Measurement.");
            }
            return(BadRequest("Could not delete Measurment"));
        }
        public async Task <IActionResult> Delete(long id)
        {
            var measurementToDelete = await _measurementRepository.Get(id);

            await _measurementRepository.Delete(measurementToDelete);

            return(NoContent());
        }
Exemple #4
0
        public async Task <IActionResult> Delete(long id)
        {
            var measurementToDelete = await _measurementRepository.Get(id);

            if (measurementToDelete == null)
            {
                return(NotFound("The measurement record couldnt be found."));
            }

            await _measurementRepository.Delete(measurementToDelete);

            return(NoContent());
        }
 public void DeleteMeasurement(int id)
 {
     _measurementRepository.Delete(id);
 }
Exemple #6
0
 public async Task Delete(long id)
 {
     await _iMeasurementRepository.Delete(id);
 }