Esempio n. 1
0
        public async Task <DeleteMedicineResponse> DeleteMedicineAsync(DeleteMedicineRequest request)
        {
            var            response = new DeleteMedicineResponse();
            MedicineEntity entity   = await _medicineRepository.GetMedicineById(request.MedicineId);

            if (entity == null)
            {
                response.StatusCode = (int)HttpStatusCode.NotFound;
                return(response);
            }

            bool status = await _medicineRepository.DeleteMedicineAsync(entity);

            if (status)
            {
                response.StatusCode = (int)HttpStatusCode.OK;
            }
            else
            {
                response.StatusCode = (int)HttpStatusCode.BadRequest;
                _logger.LogWarning(""); //TODO - LOGGING
            }

            return(response);
        }