示例#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);
        }
示例#2
0
        public async Task <IActionResult> DeleteMedicine([FromBody] DeleteMedicineRequest request)
        {
            var response = await _medicineService.DeleteMedicineAsync(request);

            return(GenerateResponse(response));
        }