Esempio n. 1
0
        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;
                    });
        }
Esempio n. 2
0
 /// <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); });
 }