public void AddNewEmployeeToDatabase(string firstname, string lastname, string middlename, DateTime birthdate, string nationality, long passportno, string sex, long phonenum, string email, int wage, string education, string contractno, DateTime firstworkdate, int officeno, Position position, string login, string password) { using (c) { c.Employees.AddOrUpdate(p => p.FirstName, new Employee { FirstName = firstname, LastName = lastname, MiddleName = middlename, BirthDate = birthdate, Nationality = nationality, PassportNo = passportno, Sex = sex, PhoneNum = phonenum, Email = email, Wage = wage, EducationInfo = education, ContractNo = contractno, FirstWorkDate = firstworkdate, OfficeNo = officeno, Position = position, Login = login, Password = password }); c.SaveChanges(); } }
public List<Employee> GetAllDoctorsWithSamePosition(Position position) { return c.Employees.Where(e => e.Position.PositionName == position.PositionName).ToList(); }