예제 #1
0
        /// <inheritdoc />
        public FarfetchMessage <bool> Delete(string username)
        {
            if (_userAccountService == null)
            {
                throw new NullReferenceException("User Account Service hasn't been defined");
            }
            User user = _userAccountService.GetByExpression(x => x.Username == username);

            if (user == null)
            {
                return(new FarfetchMessage <bool>
                {
                    Result = false
                });
            }
            try
            {
                _userAccountService.Delete(user.Id);
                return(new FarfetchMessage <bool>
                {
                    Result = true
                });
            }
            catch (Exception)
            {
                return(new FarfetchMessage <bool>
                {
                    Result = false
                });
            }
        }