public EmpTB InsertEmployee(EmpTB objemp)
        {
            dc.EmpTBs.InsertOnSubmit(objemp);
            dc.SubmitChanges();

            return(objemp);
        }
        public EmpTB EditEmployee(int id, EmpTB objemp)
        {
            var q3 = dc.EmpTBs.SingleOrDefault(s => s.Id == id);

            q3.EmpName = objemp.EmpName;
            q3.Salary  = objemp.Salary;
            q3.Gender  = objemp.Gender;
            q3.DeptId  = objemp.DeptId;
            dc.SubmitChanges();
            return(q3);
        }
Example #3
0
        public ActionResult Edit(int id, EmpTB objemps)
        {
            try
            {
                wc.EditEmployee(id, objemps);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #4
0
        public ActionResult Create(EmpTB emp)
        {
            try
            {
                wc.InsertEmployee(emp);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #5
0
 public IActionResult Post(EmpTB empTB)
 {
     libraryContext.Add(empTB);
     libraryContext.SaveChanges();
     return(Ok(empTB));
 }