Beispiel #1
0
        public HROfficer bringHROfficer(string id)
        {
            HROfficerRepository repo = new HROfficerRepository();
            HROfficer           data = repo.Get(Convert.ToInt32(id));

            return(data);
        }
        public int Delete(int id)
        {
            HROfficer HROfficerToDelete = context.HROfficers.SingleOrDefault(d => d.HR_acc_Id == id);

            context.HROfficers.Remove(HROfficerToDelete);
            return(context.SaveChanges());
        }
        public int Update(HROfficer HROfficer)
        {
            HROfficer HROfficerToUpdate = context.HROfficers.SingleOrDefault(d => d.HR_acc_Id == HROfficer.HR_acc_Id);

            HROfficerToUpdate.HR_name     = HROfficer.HR_name;
            HROfficerToUpdate.HR_password = HROfficer.HR_password;
            return(context.SaveChanges());
        }
        public int Insert(HROfficer HROfficer)
        {
            Logininfo li = new Logininfo();

            li.Login_acc_no   = context.HROfficers.Count() + 1;
            li.Login_Name     = HROfficer.HR_name;
            li.Login_Password = HROfficer.HR_password;
            li.Login_type     = "HROfficer";

            context.Logininfos.Add(li);
            context.HROfficers.Add(HROfficer);
            return(context.SaveChanges());
        }