public EmployeeModel Get(string id) { EmployeeRequestObject req = new EmployeeRequestObject(); EmployeeModel e = null; int EmpId = Convert.ToInt32(id); int EmpID = EmpId; string getAllEmp = "select * from employee where Id=@id"; SqlDataAccess d = new SqlDataAccess(con.GetConnectionForSql()); d.Connection.Open(); var cmd = d.Command(getAllEmp); AddObjectParameter(d, cmd, "Id", EmpID); IDataReader d1 = d.ReadData(cmd); { if (d1.Read()) { e = new EmployeeModel(); var empid = d1["Id"]; e.Id = Convert.ToInt32(empid); //var empName = d1["Name"]; //e.Name = Convert.ToString(empName); } // e.Id = ddd.; } return(e); d.Connection.Close(); }
public EmployeeModel Get(string Empid) { //EmployeeModel e1=new EmployeeModel(); EmployeeRequestObject e2 = new EmployeeRequestObject(); int id = Convert.ToInt32(Empid); // e2.Id = id; // string s = i.ToString(); return(e.Get(Empid)); }
public void Delete([FromUri] string id) { EmployeeRequestObject ep = new EmployeeRequestObject(); int Empid; //int i = ep.Id; //ep.Id = id; //string s = i.ToString(); // Empid = Convert.ToInt32(id); e.Delete(id); }
static void Main(string[] args) { EmployeeOperationEf ef = new EmployeeOperationEf(); EmployeeRequestObject req = new EmployeeRequestObject(); string id = "17"; // ef.GetAll(); string Id = "4"; ef.GetAll(); ef.Get(id); EmployeeRequestObject e11 = new EmployeeRequestObject(); e11.Id = 8; ef.Delete(Id); EmployeeModel e = new EmployeeModel(); e.Name = "dyu"; }
static void Main(string[] args) { // Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name); string s; Console.Write("Enter type: "); s = Console.ReadLine(); object obj; switch (s) { case "ef": EmployeeOperationEf ef = new EmployeeOperationEf(); EmployeeRequestObject req = new EmployeeRequestObject(); string id = "17"; // ef.GetAll(); string Id = "4"; ef.GetAll(); ef.Get(id); EmployeeRequestObject e11 = new EmployeeRequestObject(); e11.Id = 8; ef.Delete(Id); EmployeeModel e = new EmployeeModel(); e.Name = "dyu"; // e.Id = 7; // ef.Edit(e); // ef.AddEmployee(e); break; case "ado": //req.Id = Convert.ToInt32(id); EmployeeOperation e3 = new EmployeeOperation(); // SalaryOperations s =new SalaryOperations(); // SalaryModel s1=new SalaryModel(); // s1.SalaryId = 101; // s1.SalaryPaidAmount = 234567; // s1.EmployeeId = 4; //int n=s.AddSalary(s1); // // s.Edit(s1); // s.Delete("3"); EmployeeModel em = new EmployeeModel(); em.Name = "lalit"; // em.Designation = "Developer"; // e.AddEmployee(em); e3.GetAll(); // e.Get("2"); // // em.Id; //e.Edit(em); // e.Delete("2/*");*/ break; default: Console.WriteLine("no suitable op"); break; } //// EmployeeOperationEf e1=new EmployeeOperationEf(); //EmployeeModel model=new EmployeeModel(); //model.Name = "vijay"; //model.Id = 13; //// model.Doj = DateTime.Parse("11/23/2010"); ////e1.AddEmployee(model); ////e1.Edit(model); //// e1.Delete("16"); ////e1.Get("17"); //e1.GetAll(); Console.ReadLine(); }