Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            demodbEntities  con = new demodbEntities();
            DemotblEmployee emp = con.DemotblEmployees.FirstOrDefault(x => x.Id.Equals(id));

            return(View(emp));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            SampleDb        sampleDb         = new SampleDb();
            DemotblEmployee selectedEmployee = sampleDb.DemotblEmployees.FirstOrDefault(x => x.Id == id);

            return(View(selectedEmployee));
        }
Ejemplo n.º 3
0
        public ActionResult Delete(DemotblEmployee emp)
        {
            demodbEntities con = new demodbEntities();

            con.Entry(emp).State = System.Data.Entity.EntityState.Deleted;
            con.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        public ActionResult Delete(int id)
        {
            demodbEntities  con = new demodbEntities();
            DemotblEmployee selectedEmployee =
                con.DemotblEmployees.FirstOrDefault(x => x.Id == id);

            return(View(selectedEmployee));
        }
Ejemplo n.º 5
0
        public ActionResult Create(DemotblEmployee emp)
        {
            demodbEntities con = new demodbEntities();

            con.DemotblEmployees.Add(emp);
            con.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 6
0
        public ActionResult Create(DemotblEmployee emp)
        {
            SampleDb sampleDb = new SampleDb();

            sampleDb.DemotblEmployees.Add(emp);
            sampleDb.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        public ActionResult Delete(DemotblEmployee demoemp)
        {
            SampleDb        sampleDb         = new SampleDb();
            DemotblEmployee selectedEmployee = sampleDb.DemotblEmployees.FirstOrDefault(x => x.Id == demoemp.Id);

            sampleDb.DemotblEmployees.Remove(selectedEmployee);
            sampleDb.SaveChanges();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 8
0
        public ActionResult Edit(DemotblEmployee demoemp)
        {
            demodbEntities con = new demodbEntities();

            //DemotblEmployee emp = con.DemotblEmployees.FirstOrDefault(x => x.Id.Equals(demoemp.Id));
            //emp.FullName = demoemp.FullName;
            //emp.Gender = demoemp.Gender;
            //emp.Age = demoemp.Age;
            //emp.EmailAddress = demoemp.EmailAddress;
            //emp.HireDate = demoemp.HireDate;
            //emp.Salary = demoemp.Salary;
            //emp.PersonalWebSite = demoemp.PersonalWebSite;
            con.Entry(demoemp).State = System.Data.Entity.EntityState.Modified;
            con.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 9
0
        public ActionResult Edit(DemotblEmployee demoemp)
        {
            SampleDb sampleDb = new SampleDb();

            //DemotblEmployee selectedEmployee = sampleDb.DemotblEmployees.FirstOrDefault(x => x.Id == demoemp.Id);
            //selectedEmployee.FullName = demoemp.FullName;
            //selectedEmployee.Gender = demoemp.Gender;
            //selectedEmployee.Age = demoemp.Age;
            //selectedEmployee.EmailAddress = demoemp.EmailAddress;
            //selectedEmployee.HireDate = demoemp.HireDate;
            //selectedEmployee.Salary= demoemp.Salary;
            //selectedEmployee.PersonalWebSite = demoemp.PersonalWebSite;

            sampleDb.Entry(demoemp).State = System.Data.Entity.EntityState.Modified;
            sampleDb.SaveChanges();
            return(RedirectToAction("Index"));
        }