public Task Update(Employee entity) { return Task.Run( () => { var orignial = this.dataContext.Employees.FirstOrDefault(e => e.EmployeeId.Equals(entity.EmployeeId)); if (orignial != null) { this.dataContext.Entry(orignial).CurrentValues.SetValues(entity); } //this.dataContext.Entry(entity).State = EntityState.Modified; }); }
/// <summary> /// The insert. /// </summary> /// <param name="entity"> /// The entity. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public Task Insert(Employee entity) { return Task.Run( () => { this.dataContext.Employees.Add(entity); }); }