示例#1
0
        public async Task <ActionResult <CashAccounts> > PostCashAccounts(CashAccounts cashAccounts)
        {
            _context.CashAccounts.Add(cashAccounts);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCashAccounts", new { id = cashAccounts.CashAccountId }, cashAccounts));
        }
示例#2
0
        /// <summary>
        /// Открывает новый счет с пустым балансом
        /// </summary>
        /// <param name="status"></param>
        /// <param name="num"></param>
        public void NewCashAcc(string status, string num)
        {
            string       inn  = "";
            string       pass = "";
            string       sql  = "";
            CashAccounts ca   = new CashAccounts()
            {
                AccFinance = 0,
                Active     = true,
                NumCashAcc = GetNewCashAcc(),
                PeriodAcc  = DateTime.Now.AddYears(5),
                TypeAcc    = "DEPOSITE"
            };

            try
            {
                if (status == "COMPANY")
                {
                    inn             = num;
                    ca.NumClientINN = num;
                    sk.CashAccounts.Local.Add(ca);
                }
                else
                {
                    pass = num;
                    ca.NumClientPassport = num;
                    sk.CashAccounts.Local.Add(ca);
                }

                sk.SaveChanges();
            }
            catch (Exception e) { MessageBox.Show(e.Message); }
        }
示例#3
0
        public async Task <IActionResult> PutCashAccounts(int id, CashAccounts cashAccounts)
        {
            if (id != cashAccounts.CashAccountId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }