Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,InvestmentId,ProjectId,InvestorId,Amount,RaisedAmount,IsLive")] Funded funded)
        {
            if (id != funded.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(funded);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FundedExists(funded.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InvestmentId"] = new SelectList(_context.Investments, "Id", "Id", funded.InvestmentId);
            ViewData["InvestorId"]   = new SelectList(_context.Investors, "Id", "Id", funded.InvestorId);
            ViewData["ProjectId"]    = new SelectList(_context.Projects, "Id", "Name", funded.ProjectId);
            return(View(funded));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,InvestmentId,ProjectId,InvestorId,Amount,RaisedAmount,IsLive")] Funded funded)
        {
            if (ModelState.IsValid)
            {
                _context.Add(funded);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InvestmentId"] = new SelectList(_context.Investments, "Id", "Id", funded.InvestmentId);
            ViewData["InvestorId"]   = new SelectList(_context.Investors, "Id", "Id", funded.InvestorId);
            ViewData["ProjectId"]    = new SelectList(_context.Projects, "Id", "Name", funded.ProjectId);
            return(View(funded));
        }
Example #3
0
        // GET: Fundeds/Create
        public IActionResult Create(InvestmentViewModel model)
        {
            var userId = _userManager.GetUserId(HttpContext.User);
            var funded = new Funded
            {
                ProjectId  = model.Project.Id,
                InvestorId = userId,
                Amount     = model.Investment.Amount
            };



            return(View());
        }
        public async Task <IActionResult> PendingFunds([Bind("Id,InvestmentRegNo,Amount,ProjectId,InvestorId,IsApproved")] Investment model)
        {
            if (!ModelState.IsValid)
            {
                return(NotFound());
            }
            var fund = new Funded
            {
                InvestmentId = model.Id,
                InvestorId   = model.InvestorId,
                ProjectId    = model.ProjectId,
                Amount       = model.Amount
            };
            var investment = await _context.Investments.FindAsync(model.Id);

            investment.IsApproved = model.IsApproved;
            await _context.SaveChangesAsync();

            await _context.Fundeds.AddAsync(fund);

            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(PendingFunds)));
        }
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (SessionProfitLoss != null)
                {
                    hashCode = hashCode * 59 + SessionProfitLoss.GetHashCode();
                }
                if (MarkPrice != null)
                {
                    hashCode = hashCode * 59 + MarkPrice.GetHashCode();
                }
                if (Funding != null)
                {
                    hashCode = hashCode * 59 + Funding.GetHashCode();
                }
                if (Socialized != null)
                {
                    hashCode = hashCode * 59 + Socialized.GetHashCode();
                }
                if (SessionBankrupcy != null)
                {
                    hashCode = hashCode * 59 + SessionBankrupcy.GetHashCode();
                }
                if (Timestamp != null)
                {
                    hashCode = hashCode * 59 + Timestamp.GetHashCode();
                }
                if (ProfitLoss != null)
                {
                    hashCode = hashCode * 59 + ProfitLoss.GetHashCode();
                }
                if (Funded != null)
                {
                    hashCode = hashCode * 59 + Funded.GetHashCode();
                }
                if (IndexPrice != null)
                {
                    hashCode = hashCode * 59 + IndexPrice.GetHashCode();
                }
                if (SessionTax != null)
                {
                    hashCode = hashCode * 59 + SessionTax.GetHashCode();
                }
                if (SessionTaxRate != null)
                {
                    hashCode = hashCode * 59 + SessionTaxRate.GetHashCode();
                }
                if (InstrumentName != null)
                {
                    hashCode = hashCode * 59 + InstrumentName.GetHashCode();
                }
                if (Position != null)
                {
                    hashCode = hashCode * 59 + Position.GetHashCode();
                }

                hashCode = hashCode * 59 + Type.GetHashCode();
                return(hashCode);
            }
        }
        /// <summary>
        /// Returns true if Settlement instances are equal
        /// </summary>
        /// <param name="other">Instance of Settlement to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Settlement other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     SessionProfitLoss == other.SessionProfitLoss ||
                     SessionProfitLoss != null &&
                     SessionProfitLoss.Equals(other.SessionProfitLoss)
                     ) &&
                 (
                     MarkPrice == other.MarkPrice ||
                     MarkPrice != null &&
                     MarkPrice.Equals(other.MarkPrice)
                 ) &&
                 (
                     Funding == other.Funding ||
                     Funding != null &&
                     Funding.Equals(other.Funding)
                 ) &&
                 (
                     Socialized == other.Socialized ||
                     Socialized != null &&
                     Socialized.Equals(other.Socialized)
                 ) &&
                 (
                     SessionBankrupcy == other.SessionBankrupcy ||
                     SessionBankrupcy != null &&
                     SessionBankrupcy.Equals(other.SessionBankrupcy)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     ProfitLoss == other.ProfitLoss ||
                     ProfitLoss != null &&
                     ProfitLoss.Equals(other.ProfitLoss)
                 ) &&
                 (
                     Funded == other.Funded ||
                     Funded != null &&
                     Funded.Equals(other.Funded)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     SessionTax == other.SessionTax ||
                     SessionTax != null &&
                     SessionTax.Equals(other.SessionTax)
                 ) &&
                 (
                     SessionTaxRate == other.SessionTaxRate ||
                     SessionTaxRate != null &&
                     SessionTaxRate.Equals(other.SessionTaxRate)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ) &&
                 (
                     Position == other.Position ||
                     Position != null &&
                     Position.Equals(other.Position)
                 ) &&
                 (
                     Type == other.Type ||

                     Type.Equals(other.Type)
                 ));
        }