public async Task <IHttpActionResult> PutValuation(int id, Valuation valuation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(valuation).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public async Task UpdateAsync(Portfolio portoflio)
 {
     using (_db)
     {
         _db.Portfolios.Attach(portoflio);
         _db.Entry(portoflio).State = EntityState.Modified;
         await _db.SaveChangesAsync();
     }
 }
Esempio n. 3
0
 public async Task UpdateAsync(PriceValue pricevalue)
 {
     using (_db)
     {
         _db.PriceValues.Attach(pricevalue);
         _db.Entry(pricevalue).State = EntityState.Modified;
         await _db.SaveChangesAsync();
     }
 }