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; }
/// <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); }
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)); }
public void Delete(project_partnerModel entity) { _context.Entry <project_partnerModel>(entity).State = EntityState.Deleted; }
public void Update(ExpenditureModel entity) { entity.updated = DateTime.Now; _context.Entry(entity).State = EntityState.Modified; _context.Entry(entity).Property(a => a.created).IsModified = false; }
/// <summary> /// 更新一筆Entity內容。 /// </summary> /// <param name="entity">要更新的內容</param> public void Update(TEntity entity) { Context.Entry <TEntity>(entity).State = EntityState.Modified; }