Esempio n. 1
0
        public async Task <Result> CreateRole(RoleDTO role)
        {
            try
            {
                if (await _roleDAL.CheckRoleExists(role.Name) != 0)
                {
                    return(Result.CreateFailure(ErrorCodeEnum.RoleNameAlreadyExists));
                }

                await _roleDAL.CreateRoleAsync(role);

                await _roleDAL.CommitAsync();

                return(Result.CreateSuccess());
            }

            catch (Exception ex)
            {
                return(Result.CreateFailure(ex));
            }
        }