public async Task <ActionResult <SBTransaction> > PostSBTransaction(SBTransaction sBTransaction)
        {
            _context.sBTransactions.Add(sBTransaction);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSBTransaction", new { id = sBTransaction.TransactionID }, sBTransaction));
        }
        public async Task <IActionResult> PutSBTransaction(int id, SBTransaction sBTransaction)
        {
            if (id != sBTransaction.TransactionID)
            {
                return(BadRequest());
            }

            _context.Entry(sBTransaction).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SBTransactionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult> Delete(SBTransaction b)
        {
            int vid = Convert.ToInt32(TempData["TransactionID"]);

            using (var httpClient = new HttpClient())
            {
                using (var response = await httpClient.DeleteAsync("http://localhost:37797/api/SBTransactions/" + vid))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();
                }
            }
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Details(int id)
        {
            SBTransaction sba = new SBTransaction();

            using (var httpClient = new HttpClient())
            {
                using (var response = await httpClient.GetAsync("http://localhost:37797/api/SBTransactions/" + id))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    sba = JsonConvert.DeserializeObject <SBTransaction>(apiResponse);
                }
            }
            return(View(sba));
        }
        public async Task <ActionResult> Create(SBTransaction sbt)
        {
            using (var httpClient = new HttpClient())
            {
                StringContent content = new StringContent(JsonConvert.SerializeObject(sbt), Encoding.UTF8, "application/json");

                using (var response = await httpClient.PostAsync("http://localhost:37797/api/SBTransactions", content))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    var obj = JsonConvert.DeserializeObject <SBTransaction>(apiResponse);
                }
            }
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Delete(int id)
        {
            TempData["TransactionID"] = id;
            SBTransaction b = new SBTransaction();

            using (var httpClient = new HttpClient())
            {
                using (var response = await httpClient.GetAsync("http://localhost:37797/api/SBTransactions/" + id))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    b = JsonConvert.DeserializeObject <SBTransaction>(apiResponse);
                }
            }
            return(View(b));
        }
        public async Task <ActionResult> Edit(SBTransaction b)
        {
            int vid = Convert.ToInt32(TempData["TransactionID"]);

            b.TransactionID = vid;
            SBTransaction receivedemp = new SBTransaction();


            using (var httpClient = new HttpClient())
            {
                StringContent content1 = new StringContent(JsonConvert.SerializeObject(b), Encoding.UTF8, "application/json");
                using (var response = await httpClient.PutAsync("http://localhost:37797/api/SBTransactions/" + vid, content1))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    receivedemp = JsonConvert.DeserializeObject <SBTransaction>(apiResponse);
                }
            }
            return(RedirectToAction("Index"));
        }