示例#1
0
 /// <summary>
 /// Update entity
 /// </summary>
 /// <param name="entity">Entity</param>
 public virtual int Update(T entity)
 {
     try
     {
         if (entity == null)
         {
             throw new ArgumentNullException(nameof(entity));
         }
         Entities.Attach(entity);
         _context.Entry(entity).State = EntityState.Modified;
         return(_context.SaveChanges());
     }
     catch (Exception ex)
     {
         throw new Exception(GetFullErrorTextAndRollbackEntityChanges(ex), ex);
     }
 }
示例#2
0
 public virtual T Update(T entity)
 {
     dbContext.Entry(entity).State = EntityState.Modified;
     dbContext.SaveChanges();
     return(entity);
 }
示例#3
0
 public User Update(User entity)
 {
     dbContext.Entry(entity).State = EntityState.Modified;
     dbContext.SaveChanges();
     return(entity);
 }