public ActionResult Edit(int id)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            Vehicle a = db.Vehicles.Find(id);

            return(View(a));
        }
        // GET: Vehicles
        public ActionResult Index()
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            var allVehicles = db.Vehicles.ToList();

            return(View(allVehicles));
        }
Beispiel #3
0
        public ActionResult Edit(int id)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            Employee employee = db.Employees.Find(id);

            ViewBag.employeedata = employee;

            return(View());
        }
Beispiel #4
0
        // GET: Employees
        public ActionResult Index()

        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();

            var employees = db.Employees.ToList();

            ViewBag.allemployees = employees;
            return(View());
        }
        public ActionResult Edit(Vehicle e)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();

            db.Entry(e).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            //TempDate[] persists for the next HttpRequest and is disposed automaticaly by asp.net
            TempData["successmsg"] = "Vehicle Edited Sucessfully";
            return(RedirectToAction("Edit"));
        }
        [HttpPost]//store in the database
        public ActionResult Create(Vehicle v)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();

            db.Vehicles.Add(v);
            db.SaveChanges();

            //TempDate[] persists for the next HttpRequest and is disposed automaticaly by asp.net
            TempData["successmsg"] = "Vehicle Created Sucessfully";
            return(RedirectToAction("Create"));
        }
        public ActionResult Delete(int id)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            Vehicle vehicleToDelete             = db.Vehicles.Find(id);

            db.Vehicles.Remove(vehicleToDelete);
            db.SaveChanges();
            //TempDate[] persists for the next HttpRequest and is disposed automaticaly by asp.net
            TempData["successmsg"] = "Employee Deleted Successfully ";

            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        public ActionResult Delete(int id)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            Employee employeeToDelete           = db.Employees.Find(id);

            ViewBag.employeedata = employeeToDelete;
            //To delete the employee
            db.Employees.Remove(employeeToDelete);
            db.SaveChanges();
            //Send a Success message back to the user
            TempData["successmsg"] = "Employee Deleted Successfully ";

            return(RedirectToAction("Index"));
        }
Beispiel #9
0
        public ActionResult Create(string fname, string lname, string sex, string age, string salary, string address)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            Employee empObj = new Employee();

            empObj.FirstName = fname;
            empObj.LastName  = lname;
            empObj.Sex       = sex;
            empObj.Age       = int.Parse(age);
            empObj.Salary    = decimal.Parse(salary);
            empObj.Address   = address;

            db.Employees.Add(empObj);
            db.SaveChanges();

            //TempData[key] persists for the next HHP request and
            TempData["successmsg"] = "Employee Successfully Created";

            // ViewBag.successmsg = "Employee Successfully Created";
            return(RedirectToAction("index"));
        }
Beispiel #10
0
        public ActionResult Edit(string Id, string fname, string lname, string sex, string age, string salary, string address)
        {
            EmployeeManagementSystemEntities db = new EmployeeManagementSystemEntities();
            Employee empObj = new Employee();

            empObj.id        = int.Parse(Id);
            empObj.FirstName = fname;
            empObj.LastName  = lname;
            empObj.Sex       = sex;
            empObj.Age       = int.Parse(age);
            empObj.Salary    = decimal.Parse(salary);
            empObj.Address   = address;

            db.Entry(empObj).State = EntityState.Modified;

            db.SaveChanges();
            //TempData[key] persists for the next HTTzP request and
            TempData["successmsg"] = "Employee Modified Successfully ";


            // ViewBag.successmsg = "Employee Modified Successfully ";
            return(RedirectToAction("index"));
        }