コード例 #1
0
ファイル: StoreController.cs プロジェクト: thuyvtk/Mobile-BE
        public ActionResult GetCustomerByAccountId(string Id)
        {
            var AccountId = _accountService.GetAccounts(a => a.User_Id.Equals(Id)).ToList();

            if (!AccountId.Any())
            {
                CreateAccount(Id);
                //get created account
                var   accountCreated = _accountService.GetAccounts(t => t.User_Id.Equals(Id)).ToList();
                Store customer       = CreateStore(accountCreated);
                return(Ok(customer.Adapt <CustomerVM>()));
            }
            var result = _storeService.GetStores(c => c.AccountId == AccountId[0].Id).ToList();

            if (!result.Any())
            {
                Store customer = CreateStore(AccountId);
                return(Ok(customer.Adapt <CustomerVM>()));
            }
            return(Ok(result[0].Adapt <StoreVM>()));
        }