Beispiel #1
0
        public UserApp UserAppInsert(UserApp userApp)
        {
            try
            {
                if (_data.ExistsUserNumber(userApp))
                {
                    throw new ExceptionBusiness($"There is already a user with an identification number {userApp.IdentificationNumber}");
                }

                userApp.DateCreation = DateTime.Now;

                var userId = _data.Insert <int>(userApp);
                userApp.UserId = userId;

                return(userApp);
            }
            catch (DataErrorException ex)
            {
                Logger.ErrorFatal("UserAppInsert", ex);
                throw ex;
            }
            catch (ExceptionBusiness)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.ErrorFatal("GetUserAppsFromFilter", ex);
                throw ex;
            }
        }