コード例 #1
0
        public async Task <bool> Edit(int id, Customer customer)
        {
            _context.Update(customer);
            await _context.SaveChangesAsync();

            return(true);
        }
コード例 #2
0
 public void Update(DailyIntake item)
 {
     try
     {
         db.Update <DailyIntake>(item);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #3
0
 public void Update(Balance_NG_3 item)
 {
     try
     {
         db.Update <Balance_NG_3>(item);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #4
0
 public void Update(Directory_Metering_Units item)
 {
     try
     {
         db.Update <Directory_Metering_Units>(item);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #5
0
 public void Update(DailyProduction item)
 {
     try
     {
         db.Update <DailyProduction>(item);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
コード例 #6
0
 public bool Update <TEntity>(TEntity entity) where TEntity : class
 {
     try
     {
         _dbContext.Update(entity);
         _dbContext.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         throw new InvalidDataException(e.Message);
     }
 }
コード例 #7
0
        public async Task <TEntity> UpdateAsync(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException($"{nameof(AddAsync)} entity must not be null");
            }

            try
            {
                _eFDbContext.Update(entity);
                await _eFDbContext.SaveChangesAsync();

                return(entity);
            }
            catch (Exception)
            {
                throw new Exception($"{nameof(entity)} could not be updated");
            }
        }
コード例 #8
0
 public IActionResult Put([FromBody, Required] Employee employee)
 {
     _efDbContext.Update(employee);
     _efDbContext.SaveChanges();
     return(new OkObjectResult(employee));
 }
コード例 #9
0
 public void Update(Category category)
 {
     _context.Update(category);
     _context.SaveChanges();
 }
コード例 #10
0
ファイル: CommonRepository.cs プロジェクト: luochunjiu/lcj
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entity"></param>
        /// <param name="IsFind"></param>
        /// <returns></returns>
        public bool Update <TEntity>(TEntity entity, bool isFind) where TEntity : class
        {
            _dbContext.Update(entity);

            return(_dbContext.SaveChanges() > 0);
        }