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); }
public async Task <MedicineDomain> GetMedicineById(int medicineId) { var medicine = await _medicineRepository.GetMedicineById(medicineId); var medicineDomain = _mapper.Map <MedicineDomain>(medicine); return(medicineDomain); }
public ActionResult Edit(string id) { var intId = 0; int.TryParse(id, out intId); Medicine medicine = null; try { medicine = medicineRepository.GetMedicineById(intId); if (medicine == null) { return(RedirectToAction("Error404", "Error")); } } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } IMedicineTypeRepository objMedicineType = new MedicineTypeRepository(); IMedicineUnitRepository objMedicineUnit = new MedicineUnitRepository(); IEnumerable <MedicineType> medicineTypeRecords = null; IEnumerable <MedicineUnit> unitRecords = null; try { medicineTypeRecords = objMedicineType.Get(); unitRecords = objMedicineUnit.Get(); } catch (Exception ex) { log.Error(ex); ModelState.AddModelError("error", Translator.UnexpectedError); } medicineModel = new MedicineModels { medicine = medicine, medicineTypeRecords = medicineTypeRecords, unitRecords = unitRecords }; return(View(medicineModel)); }
private MedicineAssignedVM GetMedicineViewModel(prescription prescriptionItem) { medicine med = _medicineRepository.GetMedicineById(prescriptionItem.medicine_id); return(new MedicineAssignedVM() { Name = med.medicine_name, Description = prescriptionItem.description, Quantity = prescriptionItem.quantity_indicated.ToString(), SalePrice = med.sale_price_per_unit.ToString(), Unit = med.sale_unit }); }
public void Display(int idSelected) { var medicineFromDB = _repository.GetMedicineById(idSelected); if (medicineFromDB != null) { _view.TxtMedicineName = medicineFromDB.medicine_name; _view.TxtEntryQuantity = medicineFromDB.quantity_in_entry_unit.ToString(); _view.TxtEntryUnit = medicineFromDB.entry_unit; _view.TxtEntryPrice = medicineFromDB.entry_price.ToString(); _view.TxtExpiryDay = String.Format("{0:dd/MM/yyyy}", medicineFromDB.expiry_day); _view.TxtSaleUnit = medicineFromDB.sale_unit; _view.TxtSalePrice = medicineFromDB.sale_price_per_unit.ToString(); _view.TxtExchangeRatio = medicineFromDB.unit_exchange_ratio.ToString(); } }
public async Task <Medicine> GetMedicineById(int id) { return(await medicineRepository.GetMedicineById(id)); }
public Medicine GetMedicineById(int id) { return(_repository.GetMedicineById(id)); }
public Medicine GetMedicineById(long id) { return(medicineRepository.GetMedicineById(id)); }
/// <summary> /// get medicine by id /// </summary> /// <returns></returns> private async Task <Medicine> GetMedicineById(Guid?id) { return(await _medicineRepository.GetMedicineById(id)); }