public void createInstallation(InstallationModel installation)
        {
            try
            {
                ValidationResults vresult = Validation.ValidateFromAttributes <InstallationModel>(installation);

                if (vresult.IsValid)
                {
                    irepo.Add(installation);
                    irepo.Save();
                    log.Info("Installation saved.");
                }
                else
                {
                    log.Warn(vresult.Count + "Validation errors");
                    StringBuilder sb = null;
                    foreach (var error in vresult)
                    {
                        sb = new StringBuilder();
                        sb.Append("Error on property ");
                        sb.Append(error.Target);
                        sb.Append(": ");
                        sb.Append(error.Message);
                    }
                    log.Warn(sb);
                }
            }
            catch (DalException exp)
            {
                log.Error("Installation konnte nicht gespeichert werden.");
                throw new BLException("Installation konnte nicht gespeichert werden.", exp);
            }
        }
Exemple #2
0
 public Installation AddInstallation(Installation installation)
 {
     return(_installationRepository.Add(installation));
 }