コード例 #1
0
        public void update(int id, Class entities)
        {
            var classdetail = context.classes.FirstOrDefault(e => e.ClassId == id);

            if (classdetail != null)
            {
                classdetail.ClassId     = entities.ClassId;
                classdetail.ClassName   = entities.ClassName;
                classdetail.Description = entities.Description;
                context.SaveChanges();
            }
        }
コード例 #2
0
        public void update(int id, Course entities)
        {
            var coursedetail = context.Courses.FirstOrDefault(e => e.CourseId == id);

            if (coursedetail != null)
            {
                coursedetail.CourseId    = entities.CourseId;
                coursedetail.CourseName  = entities.CourseName;
                coursedetail.Description = entities.Description;
                context.SaveChanges();
            }
        }
コード例 #3
0
        public void update(int id, School entities)
        {
            var schooldetail = context.Schools.FirstOrDefault(e => e.Id == id);

            if (schooldetail != null)
            {
                schooldetail.Id         = entities.Id;
                schooldetail.SchoolName = entities.SchoolName;
                schooldetail.SchoolType = entities.SchoolType;
                schooldetail.City       = entities.City;
                schooldetail.Country    = entities.Country;
                context.SaveChanges();
            }
        }
コード例 #4
0
        public void update(int id, Student entities)
        {
            var studentdetail = context.Students.FirstOrDefault(e => e.Id == id);

            if (studentdetail != null)
            {
                studentdetail.Id       = entities.Id;
                studentdetail.Name     = entities.Name;
                studentdetail.DOB      = entities.DOB;
                studentdetail.Gender   = entities.Gender;
                studentdetail.City     = entities.City;
                studentdetail.ClassId  = entities.ClassId;
                studentdetail.CourseId = entities.CourseId;
                studentdetail.SchoolId = entities.SchoolId;
                context.SaveChanges();
            }
        }
コード例 #5
0
 public Student AddStudent(Student student)
 {
     context.Add(student);
     context.SaveChanges();
     return(student);
 }
コード例 #6
0
 public int Complete()
 {
     return(_context.SaveChanges());
 }
コード例 #7
0
 public void Add(TEntity entities)
 {
     context.Set <TEntity>().Add(entities);
     context.SaveChanges();
 }