public void SelectEmpTitleItem(string matchItem)
        {
            EmployeeTitle.WaitRetry(_driver).Click();
            SelectElement se = new SelectElement(EmployeeTitle);

            se.SelectByText(matchItem);
        }
        public IHttpActionResult PutEmployeeTitle(int id, EmployeeTitle employeeTitle)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employeeTitle.ID)
            {
                return(BadRequest());
            }

            db.Entry(employeeTitle).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeTitleExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public EFGenerator()
        {
            using (var context = new TimesheetsContext())
            {
                try
                {
                    //var dep = new Department() { Id = 3 };            // Creates a new department table, doesnt use exisiting.
                    var dep = context.Departments.First();              // When loaded from context, it works correctly.

                    var title = new EmployeeTitle()
                    {
                        Id = 3
                    };                                                  // Same pattern as above.

                    var emp = new Employee()
                    {
                        EmployeeTitleId = (int)TitlesEnum.Lady,          // Storing enum directoy as int againest FK property WORKS!!
                        Department      = dep,
                        Email           = "*****@*****.**",
                        Forename        = "Bill",
                        Surname         = "Mathers"
                    };

                    context.Employees.Add(emp);

                    context.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                }
            }
        }
        public IHttpActionResult GetEmployeeTitle(int id)
        {
            EmployeeTitle employeeTitle = db.EmployeeTitle.Find(id);

            if (employeeTitle == null)
            {
                return(NotFound());
            }

            return(Ok(employeeTitle));
        }
        public IHttpActionResult PostEmployeeTitle(EmployeeTitle employeeTitle)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.EmployeeTitle.Add(employeeTitle);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = employeeTitle.ID }, employeeTitle));
        }
        public IHttpActionResult DeleteEmployeeTitle(int id)
        {
            EmployeeTitle employeeTitle = db.EmployeeTitle.Find(id);

            if (employeeTitle == null)
            {
                return(NotFound());
            }

            db.EmployeeTitle.Remove(employeeTitle);
            db.SaveChanges();

            return(Ok(employeeTitle));
        }
        private void btn_add_Click(object sender, EventArgs e)
        {
            var title = new EmployeeTitle {
                Name = txt_name.Text
            };
            var result = _employeeTitleService.Add(title);

            if (result >= 0)
            {
                MessageBox.Show("İşlem Başarılı.");
                FillTitles();
            }
            else
            {
                MessageBox.Show("İşlem Başarısız.");
            }
        }
 public void Update(EmployeeTitle entity)
 {
     throw new NotImplementedException();
 }
 public void Insert(EmployeeTitle entity)
 {
     employeeTitleRepository.Insert(entity);
 }
 public void Delete(EmployeeTitle entity)
 {
     employeeTitleRepository.Delete(entity);
 }
 public int Remove(EmployeeTitle title)
 {
     _repository.Remove(title);
     return(_unitOfWork.SaveChanges());
 }
 public int Add(EmployeeTitle title)
 {
     _repository.Add(title);
     return(_unitOfWork.SaveChanges());
 }