Example #1
0
        public async Task <IActionResult> PutHolder(Guid id, Holder holder)
        {
            if (id != holder.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> PutCompany(Guid id, Company company)
        {
            if (id != company.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutTrader([FromRoute] int id, [FromBody] Trader trader)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != trader.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Example #4
0
        public bool Update(int id, TradeModel tradeModel)
        {
            db.Entry(tradeModel).State = EntityState.Modified;

            try
            {
                SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Exists(id))
                {
                    return(false);
                }
                else
                {
                    throw;
                }
            }

            return(true);
        }