protected override void OkCommandExecute() { base.OkCommandExecute(); ApplicationContext.Instance.Drugs = new List <Entity>(Items); repository.Save(); Init(); }
public void AddDrug(String name, int quantity) { bool exists = _drugRepository.DrugExists(name); if (exists) { var Foundequip = _drugRepository.GetDrug(name); Foundequip.Quantity += quantity; _drugRepository.Edit(Foundequip); } else { Drug drug = new Drug(LongRandom(0, 100000, new Random()), name, quantity); var newDrug = _drugRepository.Save(drug); } }