Ejemplo n.º 1
0
        public async Task <Permission> Create(Permission Permission)
        {
            if (!await PermissionValidator.Create(Permission))
            {
                return(Permission);
            }
            try
            {
                await UOW.PermissionRepository.Create(Permission);

                return(await UOW.PermissionRepository.Get(Permission.Id));
            }
            catch (Exception ex)
            {
                if (ex.InnerException == null)
                {
                    await Logging.CreateSystemLog(ex, nameof(PermissionService));

                    throw new MessageException(ex);
                }
                else
                {
                    await Logging.CreateSystemLog(ex.InnerException, nameof(PermissionService));

                    throw new MessageException(ex.InnerException);
                }
            }
        }