public void Edit(int?vaccinationId)
 {
     if (vaccinationId.HasValue)
     {
         var vaccination = Vaccinations.FirstOrDefault(x => x.Id == vaccinationId.Value);
         vaccination.IsInEdit = true;
     }
 }
        public void Save(int?vaccinationId)
        {
            var vaccination = Vaccinations.FirstOrDefault(x => x.Id == vaccinationId);

            if (vaccinationId.HasValue)
            {
                vaccination.Update();
            }
            else
            {
                vaccination.Save();
            }
        }
        public void Cancel(int?vaccinationId)
        {
            var vaccination = Vaccinations.FirstOrDefault(x => x.Id == vaccinationId);

            if (vaccinationId.HasValue)
            {
                vaccination.Cancel();
            }
            else
            {
                Vaccinations.Remove(vaccination);
            }
        }
 public void Delete(int?vaccinationId)
 {
     if (vaccinationId.HasValue)
     {
         var parameters = new DialogParameters();
         parameters.Add(ParametersKeys.Message, CommonResources.WarningDelete);
         parameters.Add(ParametersKeys.Title, CommonResources.Warning);
         dialogService.ShowDialog(DialogNames.MessageDialog, parameters, (r) =>
         {
             if (r.Result == ButtonResult.OK)
             {
                 petsData.DeleteVaccinationById(vaccinationId.Value);
                 var vaccination = Vaccinations.FirstOrDefault(x => x.Id == vaccinationId.Value);
                 Vaccinations.Remove(vaccination);
             }
         }
                                  );
     }
 }