Exemplo n.º 1
0
        public IHttpActionResult PutFleet(int id, Fleet fleet)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != fleet.FLEETID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FleetExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutEmployee(int id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employee.EmpID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult PutAdmin(int id, Admin admin)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != admin.AdminID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AdminExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 4
0
        public IHttpActionResult PutJobsAssigned(int id, JobsAssigned jobsAssigned)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != jobsAssigned.AssignID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JobsAssignedExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "AssignID,AssignJOBNUM,AssignCLIENT,AssignWORK,AssignAREA,AssignSTARTTIME,AssignENDTIME,AssignINSTRUCTIONS,AssignTRUCK,TextSENT")] JobsAssigned jobsAssigned)
        {
            if (ModelState.IsValid)
            {
                db.JobsAssigneds.Add(jobsAssigned);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(jobsAssigned));
        }
Exemplo n.º 6
0
        public ActionResult Create([Bind(Include = "CourseID,Name,Credits,Qualification,Description")] Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
Exemplo n.º 7
0
        public ActionResult Create([Bind(Include = "JobID,JobNUMBER,JobCLIENTS,JobWORK,JobAREA")] Job job)
        {
            if (ModelState.IsValid)
            {
                db.Jobs.Add(job);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(job));
        }
Exemplo n.º 8
0
        public ActionResult Create([Bind(Include = "AdminID,AdminNAME,AdminPASSWORD,AdminPIN")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                db.Admins.Add(admin);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(admin));
        }
Exemplo n.º 9
0
        public ActionResult Create([Bind(Include = "EmpID,EmpNAME,EmpTYPE,EmpMOBILE,EmpPHONE")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Exemplo n.º 10
0
        public ActionResult Create([Bind(Include = "FLEETID,FLEETNumber,FLEETName,FLEETDescription,FLEETRego")] Fleet fleet)
        {
            if (ModelState.IsValid)
            {
                db.Fleets.Add(fleet);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(fleet));
        }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "EmployeeJOBSID,AssignID,EmpNAME")] EmployeeJob employeeJob)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeJobs.Add(employeeJob);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AssignID = new SelectList(db.JobsAssigneds, "AssignID", "AssignJOBNUM", employeeJob.AssignID);
            return(View(employeeJob));
        }
Exemplo n.º 12
0
        public ActionResult Create([Bind(Include = "StudentID,FirstName,MiddleName,LastName,PhoneNumber,Address,InternationalStudent,EnrolmentDate,CourseID")] Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "Name", student.CourseID);
            return(View(student));
        }
Exemplo n.º 13
0
        public ActionResult Create([Bind(Include = "EnrolmentID,Grade,EnrolmentComplete,StudentID")] Enrolment enrolment)
        {
            if (ModelState.IsValid)
            {
                db.Enrolments.Add(enrolment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudentID = new SelectList(db.Students, "StudentID", "FirstName", enrolment.StudentID);
            return(View(enrolment));
        }