コード例 #1
0
        //public void DeleteEmployee(int id)
        //{
        //    var customsofficer = _context.DbContextCustomsOfficers.FindAsync(id);
        //    customsofficer.Result.Status = "Inactive";
        //    _context.DbContextCustomsOfficers.Update(customsofficer.Result);
        //    _context.SaveChangesAsync();
        //    _context.Dispose();
        //}

        //public void EditEmployee(int id, Employee customsofficer)
        //{
        //    if (id != customsofficer.EmployeeId)
        //    {

        //    }

        //    try
        //    {
        //        _context.Update(customsofficer);
        //        _context.SaveChangesAsync();
        //    }
        //    catch (DbUpdateConcurrencyException)
        //    {
        //        if (!EmployeeExists(customsofficer.EmployeeId))
        //        {

        //        }
        //        else
        //        {
        //            throw;
        //        }
        //    }
        //    _context.Dispose();
        //}

        //public void GetEmployee(int? id)
        //{
        //    if (id == null)
        //    {

        //    }

        //    var customsofficer = _context.DbContextCustomsOfficers
        //        .FirstOrDefaultAsync(m => m.EmployeeId == id);
        //    if (customsofficer == null)
        //    {

        //    }

        //    _context.Dispose();
        //}

        public void CreateEmployee(Employee customsofficer)
        {
            if (customsofficer != null)
            {
                customsofficer.RecEntered  = DateTime.Now;
                customsofficer.RecModified = DateTime.Now;
                _context.Add(customsofficer);
                _context.SaveChangesAsync();
                _context.Dispose();
            }
        }