コード例 #1
0
ファイル: DataEventoServices.cs プロジェクト: marcosalpha3/jw
 public DataEvento Adicionar(DataEvento model)
 {
     if (model.Valid)
     {
         using (RepositorySession dalSession = new RepositorySession(Runtime.JWInstance))
         {
             IUnitOfWork unitOfWork = dalSession.UnitOfWork;
             unitOfWork.Begin();
             try
             {
                 if (_repository.PesquisarporDataeCongregacao(ref unitOfWork, model) != null)
                 {
                     model.AddNotification(nameof(model.Data), Errors.EventExists);
                     unitOfWork.Rollback();
                     return(model);
                 }
                 _repository.Inserir(ref unitOfWork, model);
                 unitOfWork.Commit();
             }
             catch
             {
                 unitOfWork.Rollback();
                 throw;
             }
         }
     }
     return(model);
 }