public IHttpActionResult PutStudent(int id, Student student)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != student.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "Sno,Spassword,Sname,Ssex,Sage,Sdepartment,Smajor,Sclass,Sgpa,Scampus")] StudentInfor studentInfor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studentInfor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(studentInfor));
 }
 public ActionResult Edit([Bind(Include = "StudentId,FristName,Lastname,Grade")] StudentList studentList)
 {
     if (ModelState.IsValid)
     {
         entities.Entry(studentList).State = EntityState.Modified;
         entities.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(studentList));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "id,FirstName,LastName,Username,Password")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
 public ActionResult Edit([Bind(Include = "id,Batch1,Year")] Batch batch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(batch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(batch));
 }
Пример #6
0
 public ActionResult Edit([Bind(Include = "StudentID,FirstName,LastName,ParentsNames,Address,City,StateOrProvince,PostalCode,PhoneNumber,EmailName,Major,StudentNumber,Notes")] Students students)
 {
     if (ModelState.IsValid)
     {
         db.Entry(students).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(students));
 }
Пример #7
0
 public ActionResult Edit([Bind(Include = "ClassID,ClassName,DepartmentID,Section__,InstructorID,Term,Units,Year,Location,DaysAndTimes,Notes")] Classes classes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(classes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(classes));
 }
Пример #8
0
 public ActionResult Edit([Bind(Include = "id,Course1,Duration")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(course));
 }
 public ActionResult EditPassword([Bind(Include = "Aid,Aname,Apassword")] Administrator administrator)
 {
     if (ModelState.IsValid)
     {
         db.Entry(administrator).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Login"));
     }
     return(View(administrator));
 }
Пример #10
0
        public async Task <ActionResult> Edit([Bind(Include = "StudentsName,StudentsYear,ID")] StudentsInfo studentsInfo)
        {
            if (ModelState.IsValid)
            {
                db.Entry(studentsInfo).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(studentsInfo));
        }
Пример #11
0
 public ActionResult Edit([Bind(Include = "PersonID,LastName,FirstName,HireDate,EnrollmentDate,Discriminator")] Person person)
 {
     if (ModelState.IsValid)
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PersonID = new SelectList(db.OfficeAssignments, "InstructorID", "Location", person.PersonID);
     return(View(person));
 }
Пример #12
0
 public ActionResult Edit([Bind(Include = "id,FirstName,LastName,NIC,Course_id,Batch_id,Cell_no")] Registration registration)
 {
     if (ModelState.IsValid)
     {
         db.Entry(registration).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Batch_id  = new SelectList(db.Batches, "id", "Batch1", registration.Batch_id);
     ViewBag.Course_id = new SelectList(db.Courses, "id", "Course1", registration.Course_id);
     return(View(registration));
 }
 public ActionResult Edit([Bind(Include = "CourseID,Title,Credits,DepartmentID")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "Name", course.DepartmentID);
     ViewBag.CourseID     = new SelectList(db.OnlineCourses, "CourseID", "URL", course.CourseID);
     ViewBag.CourseID     = new SelectList(db.OnsiteCourses, "CourseID", "Location", course.CourseID);
     return(View(course));
 }
 public ActionResult Edit(string id, StudentsTable std)
 {
     try
     {
         db.Entry(std).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }