コード例 #1
0
 public void Edit(Employee employee)
 {
     if (employee is null)
     {
         throw new ArgumentNullException(nameof(employee));
     }
     dB.Update(employee);
 }
コード例 #2
0
ファイル: SqlEmployeesData.cs プロジェクト: Palych18/WebStore
        public void Update(Employee employee)
        {
            if (employee is null)
            {
                throw new ArgumentNullException(nameof(employee));
            }

            _db.Update(employee);

            _Logger.LogInformation($"Сотрудник id:{employee} отредактирован");

            _db.SaveChanges();
        }
コード例 #3
0
        public void Edit(Employee Employee)
        {
            if (Employee is null)
            {
                throw new ArgumentNullException(nameof(Employee));
            }

            //var db_item = GetById(Employee.Id);
            //if(db_item is null) return;

            //db_item.FirstName = Employee.FirstName;
            //db_item.Surname = Employee.Surname;
            //db_item.Patronymic = Employee.Patronymic;
            //db_item.Age = Employee.Age;

            //_db.Attach(Employee);
            //_db.Entry(Employee).State = EntityState.Modified;

            _db.Update(Employee);
        }