public async Task <T> UpdateAsync(T entity)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync();

            return(entity);
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,CreatedDate,RequiredByDate,Description,Status,Type,NextActionDate")] TaskProject taskProject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(taskProject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("List"));
     }
     return(View(taskProject));
 }
        public async Task <T> UpdateAsync(T entity)
        {
            // Movie
            // Id=22 PK,Identity
            // db data Title ="ABC", Revenue =1223321
            // Title = "ABC2", Revenue=5345435

            _dbContext.Entry(entity).State = EntityState.Modified;
            await _dbContext.SaveChangesAsync();

            return(entity);
        }