Exemplo n.º 1
0
 public void RemovePrescriptionItem(string pharmaceuticalName)
 {
     PrescriptionItems.Remove
     (
         PrescriptionItems.Where(p => p.PharmaceuticalName == pharmaceuticalName).FirstOrDefault()
     );
 }
Exemplo n.º 2
0
        public void AddPrescriptionItem(string pharmaceuticalName, int prescribedDailyDose, int duration,
                                        int containerSize, bool?availableOverTheCounter, string comments)
        {
            var oldItem = PrescriptionItems
                          .Where(p => p.PharmaceuticalName == pharmaceuticalName)
                          .FirstOrDefault();

            //if item not already in list add it
            if (oldItem == null)
            {
                PrescriptionItems.Add(new PrescriptionItem(pharmaceuticalName, prescribedDailyDose, duration,
                                                           containerSize, availableOverTheCounter, comments));
                return;
            }

            //update the item
            oldItem.UpdateDuration(duration);

            oldItem.PrescribedDailyDose = oldItem.PrescribedDailyDose > prescribedDailyDose ?
                                          oldItem.PrescribedDailyDose : prescribedDailyDose;
        }