예제 #1
0
        public async Task Create(Accounts inputModel)
        {
            try
            {
                inputModel.StatusActing = 1;
                await _unitOfWork.AccountsRepository.Add(inputModel);

                await _unitOfWork.SaveChange();

                if (inputModel.ListRole != null)
                {
                    foreach (var i in inputModel.ListRole)
                    {
                        var inputAccRole = new Account_Roles()
                        {
                            AccountId = inputModel.Id,
                            RoleId    = i
                        };
                        await Create_Account_Role(inputAccRole);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public async Task Create_Account_Role(Account_Roles inputAccRole)
        {
            try
            {
                await _unitOfWork.Account_RolesRepository.Add(inputAccRole);

                await _unitOfWork.SaveChange();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }