コード例 #1
0
ファイル: ProjectRepository.cs プロジェクト: jason0100/ERP
        public void Update(ProjectModel entity)
        {
            var result = new ErrorCodeLib.Models.ResultModel();

            _context.Entry(entity).State = EntityState.Modified;
            _context.Entry(entity).Property(a => a.created).IsModified = false;
        }
コード例 #2
0
        /// <summary>
        /// update existing record in entity.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns>
        /// return true if success.
        /// </returns>
        public async Task <bool> Update(T entity)
        {
            _dbContext.Entry(entity).State = EntityState.Modified;
            _dbContext.Set <T>().Update(entity);
            int id = await _dbContext.SaveChangesAsync();

            return(id == 0 ? false : true);
        }
コード例 #3
0
        public IHttpActionResult PutTjCustomer(int id, TjCustomer tjCustomer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TjCustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #4
0
 public void Delete(project_partnerModel entity)
 {
     _context.Entry <project_partnerModel>(entity).State = EntityState.Deleted;
 }
コード例 #5
0
 public void Update(ExpenditureModel entity)
 {
     entity.updated = DateTime.Now;
     _context.Entry(entity).State = EntityState.Modified;
     _context.Entry(entity).Property(a => a.created).IsModified = false;
 }
コード例 #6
0
 /// <summary>
 /// 更新一筆Entity內容。
 /// </summary>
 /// <param name="entity">要更新的內容</param>
 public void Update(TEntity entity)
 {
     Context.Entry <TEntity>(entity).State = EntityState.Modified;
 }