Example #1
0
        public ActionResult Find(EmpTable111 emp)
        {
            var context = new database111Entities();
            var model   = context.EmpTable111.FirstOrDefault((e) => e.EmpId == emp.EmpId);

            model.EmpName    = emp.EmpName;
            model.EmpAddress = emp.EmpAddress;
            model.EmpSalary  = emp.EmpSalary;
            context.SaveChanges();//Commits the changes made to the records...
            return(RedirectToAction("AllEmployees"));
        }
Example #2
0
        public ActionResult NewEmployee(EmpTable111 emp)
        {
            try
            {
                var context = new database111Entities();
                context.EmpTable111.Add(emp);
                context.SaveChanges();
                return(RedirectToAction("AllEmployees"));
            }
            catch
            {
                return(RedirectToAction("AllEmployees"));
            }

            //var context = new database111Entities();
            //context.EmpTable111.Add(emp);
            //context.SaveChanges();
            //return RedirectToAction("AllEmployees");
        }
Example #3
0
        public ViewResult NewEmployee()
        {
            var model = new EmpTable111();//No Values in it...

            return(View(model));
        }