Ejemplo n.º 1
0
        public async Task <TEntity> UpdateAsync(TEntity entity, CancellationToken cancellationToken)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;
            //?
            await _dbContext.SaveChangesAsync(cancellationToken);

            return(entity);
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "ID,name,amount")] Budget budget)
 {
     if (ModelState.IsValid)
     {
         db.Entry(budget).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(budget));
 }
Ejemplo n.º 3
0
 public async Task <ActionResult <Budget> > PutBudget(int id, Budget budget)
 {
     if (id != budget.Id)
     {
         return(BadRequest());
     }
     _context.Entry(budget).State = EntityState.Modified;
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!BudgetExists(id))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(NoContent());
 }
Ejemplo n.º 4
0
 public virtual void Update(T entity)
 {
     _db.Entry(entity).State = EntityState.Modified;
 }