コード例 #1
0
 public ActionResult Edit([Bind(Include = "QuizID,Name,Timer")] Quiz quiz)
 {
     if (ModelState.IsValid)
     {
         db.Entry(quiz).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(quiz));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "RegistrationNumber,Type,Color,Brand,Wheels,Timestamp")] ParkedVehicle parkedVehicle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parkedVehicle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parkedVehicle));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "NewsID,Title,Content,TeacherID")] News news)
 {
     if (ModelState.IsValid)
     {
         db.Entry(news).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(news));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id,VehicleType,RegistrationNumber,Color,Brand,Model,NumberOfWheels,CheckIn,CheckOut")] Vehicle vehicle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vehicle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Overview"));
     }
     return(View(vehicle));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "SubjectID,Name,MySubjectID,SClassID")] Subject subject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(subject));
 }
コード例 #6
0
 public ActionResult Edit([Bind(Include = "Id,name")] Interest interest)
 {
     if (ModelState.IsValid)
     {
         db.Entry(interest).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(interest));
 }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "Name,Size,Fee")] VehicleType vehicleType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vehicleType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vehicleType));
 }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "ParentID,FirstName")] Parent parent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parent));
 }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,StreetAdress,PostalCode,City,PhoneNumber")] Member member)
 {
     if (ModelState.IsValid)
     {
         db.Entry(member).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(member));
 }
コード例 #10
0
 public ActionResult Edit([Bind(Include = "GradeListID,Name")] GradeList gradeList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(gradeList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(gradeList));
 }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Salary,Position,Department")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "Id,userName,password,lastName,about,rememberMe,gender")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
コード例 #13
0
 public ActionResult Edit([Bind(Include = "Id,Type,RegNr,Color,Make,Model,NrOfWheels,TimeStamp")] ParkedVehicle parkedVehicle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parkedVehicle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parkedVehicle));
 }
コード例 #14
0
 public ActionResult Edit([Bind(Include = "SClassID,Name,TeacherID")] SClass sClass)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sClass).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SClassID = new SelectList(db.Teachers, "TeacherID", "Name", sClass.SClassID);
     return(View(sClass));
 }
コード例 #15
0
 public ActionResult Edit([Bind(Include = "Id,VehicleType,RegistrationNumber,Color,Brand,Model,NoOfWheels, TimestampIn")] Vehicle vehicle)
 {
     if (ModelState.IsValid)
     {
         //vehicle.TimestampIn = DateTime.Now;
         db.Entry(vehicle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vehicle));
 }
コード例 #16
0
 public ActionResult Edit([Bind(Include = "GradeID,Description,Weight,DateGrade,MySubjectID,StudentID,GradeListID")] Grade grade)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grade).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GradeListID = new SelectList(db.GradeList, "GradeListID", "GradeListID", grade.GradeListID);
     ViewBag.StudentID   = new SelectList(db.Students, "StudentID", "FirstName", grade.StudentID);
     return(View(grade));
 }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "Id,RegNr,Color,Make,Model,NrOfWheels,TimeStamp,ParkingSlot,MemberId,VehicleTypeName")] ParkedVehicle parkedVehicle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parkedVehicle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MemberId        = new SelectList(db.Members, "Id", "FirstName", parkedVehicle.MemberId);
     ViewBag.VehicleTypeName = new SelectList(db.VehicleTypes, "Name", "Name", parkedVehicle.VehicleTypeName);
     return(View(parkedVehicle));
 }
コード例 #18
0
 public ActionResult Edit([Bind(Include = "StudentID,FirstName,SClassID,ParentID")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ParentID = new SelectList(db.Parents, "ParentID", "FirstName", student.ParentID);
     ViewBag.SClassID = new SelectList(db.SClasses, "SClassID", "Name", student.SClassID);
     return(View(student));
 }
コード例 #19
0
 public ActionResult Edit([Bind(Include = "MySubjectID,TeacherID,SubjectID")] MySubject mySubject)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mySubject).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SubjectID = new SelectList(db.Subjects, "SubjectID", "Name", mySubject.SubjectID);
     ViewBag.TeacherID = new SelectList(db.Teachers, "TeacherID", "Name", mySubject.TeacherID);
     return(View(mySubject));
 }
コード例 #20
0
 public ActionResult Edit([Bind(Include = "QuestionID,Content,GoodAnswer,BadAnswer,Points,TeacherID,QuizID")] Question question)
 {
     if (ModelState.IsValid)
     {
         db.Entry(question).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.QuizID    = new SelectList(db.Quizs, "QuizID", "Name", question.QuizID);
     ViewBag.TeacherID = new SelectList(db.Teachers, "TeacherID", "Name", question.TeacherID);
     return(View(question));
 }
コード例 #21
0
 public ActionResult Edit([Bind(Include = "RegistrationNumber,Color,Brand,Wheels,ParkingTime,VehicleTypeId,MembersId")] ParkedVehicle parkedVehicle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parkedVehicle).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MembersId     = new SelectList(db.Member, "Id", "FirstName", parkedVehicle.MembersId);
     ViewBag.VehicleTypeId = new SelectList(db.VehicleTypes, "Id", "Type", parkedVehicle.VehicleTypeId);
     return(View(parkedVehicle));
 }
コード例 #22
0
        public ActionResult Edit([Bind(Include = "RegistrationNumber,Type,Color,Brand,Wheels,SelectedVehicleTypeId")] ParkVehicleViewModel model)
        {
            ParkedVehicle parkedVehicle = new ParkedVehicle
            {
                RegistrationNumber = model.RegistrationNumber.ToUpper(),
                Color         = model.Color,
                Brand         = model.Brand,
                Wheels        = model.Wheels,
                VehicleTypeId = model.SelectedVehicleTypeId
            };

            if (ModelState.IsValid)
            {
                db.Entry(parkedVehicle).State = EntityState.Modified;
                db.Entry(parkedVehicle).Property(x => x.ParkingTime).IsModified = false;
                db.Entry(parkedVehicle).Property(x => x.MembersId).IsModified   = false;
                //db.Entry(parkedVehicle).Property(x => x.VehicleTypeId).IsModified = false;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(parkedVehicle));
        }
コード例 #23
0
        public ActionResult Update([Bind(Include = "Id,Type,RegNumber,Colour,Brand,Model,NoOfWheels,CheckIn")] ParkedVehicle parkedVehicle)
        {
            //server site check for unique RegNum
            //bool IsVehicleExist = db.ParkedVehicles.Any(x => x.RegNumber == parkedVehicle.RegNumber && x.Id != parkedVehicle.Id);
            //if (IsVehicleExist == true)
            //{
            //    ModelState.AddModelError("RegNumber", "Vehicle registration number already exists");
            //}

            if (ModelState.IsValid)
            {
                db.Entry(parkedVehicle).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(parkedVehicle));
        }