Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("FunderID,Name,Email,PhoneNumber,CreditCard")] Funder funder)
        {
            if (id != funder.FunderID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(funder);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FunderExists(funder.FunderID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(funder));
        }
Пример #2
0
        public FunderTransactionBuilder Begin(long funderId, string fundableReference, DateTime utcNow)
        {
            if (fundableReference == null)
            {
                throw new ArgumentNullException(nameof(fundableReference));
            }

            m_utcNow = utcNow;

            m_funder = m_ctx.Funders.Where(r => r.FunderId == funderId).Single();

            if (fundableReference != null)
            {
                m_funderAccount = m_funder.FunderAccounts.Where(r => r.FundableReference == fundableReference).SingleOrDefault();
                if (m_funderAccount == null)
                {
                    m_funderAccount = new FunderAccount()
                    {
                        FundableReference = fundableReference,
                        UpdateDateTimeUtc = m_utcNow
                    };
                    m_funder.FunderAccounts.Add(m_funderAccount);
                }
            }

            m_funderTransaction = new FunderTransaction()
            {
                TransactionDateTimeUtc = m_utcNow,
                Fund = m_funderAccount,
                FundableReference = fundableReference,
            };
            _ = m_ctx.FunderTransactions.Add(m_funderTransaction);

            return(this);
        }
    protected void SaveUserInputEdit(Decimal FunderID)
    {
        USTTIDataAccess data   = new USTTIDataAccess();
        Funder          funder = new Funder();

        funder.FunderID     = FunderID;
        funder.FunderTypeID = Convert.ToInt32(FunderTypeList.SelectedValue);
        funder.Description  = txtFunderName.Text.Trim();
        data.UpdateFunderRecord(funder);
        Response.Redirect("funder_edit_record.aspx?funderid=" + FunderID);
    }
Пример #4
0
        public async Task <IActionResult> Create([Bind("FunderID,Name,Email,PhoneNumber,CreditCard")] Funder funder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(funder));
        }
        public IActionResult BackProject(Funder backer)
        {
            int?SessionId = HttpContext.Session.GetInt32("SessionId");

            if (SessionId == null)
            {
                return(View("LoginReg"));
            }
            else
            {
                backer.UserId = (int)SessionId;
                dbContext.Funders.Add(backer);
                dbContext.SaveChanges();
                return(RedirectToAction("AllItems"));
            }
        }