예제 #1
0
        public async Task <ResultObject> DeleteBranchAsync(int Id)
        {
            ResultObject resultObject = new ResultObject();
            var          userBranch   = await _userService.GetUserBranchesByBranchIDAsync(Id);

            if (userBranch != null)
            {
                resultObject.ServerErrors.Add(new ServerErr()
                {
                    Hint = "به دلیل وجود کاربر برای این شعبه اجازه ی حذف ندارید"
                });
                return(resultObject);
            }
            await _branchService.DeleteBranchAsync(Id);

            await _transactionManager.SaveAllAsync();

            resultObject.Result       = true;
            resultObject.ServerErrors = null;
            return(resultObject);
        }